简体   繁体   English

使用 jetpack compose 的麻烦

[英]The trouble with using jetpack compose

Task :cca-app:kaptGenerateStubsDebugKotlin Could not perform incremental compilation: Could not connect to Kotlin compile daemon Could not connect to kotlin daemon.任务 :cca-app:kaptGenerateStubsDebugKotlin 无法执行增量编译:无法连接到 Kotlin 编译守护程序无法连接到 kotlin 守护程序。 Using fallback strategy.使用回退策略。 exception: java.io.UTFDataFormatException at java.base/java.io.ObjectInputStream$BlockDataInputStream.readUTFSpan(ObjectInputStream.java:3752) at java.base/java.io.ObjectInputStream$BlockDataInputStream.readUTFBody(ObjectInputStream.java:3677) at java.base/java.io.ObjectInputStream$BlockDataInputStream.readUTF(ObjectInputStream.java:3477) at java.base/java.io.ObjectInputStream.readUTF(ObjectInputStream.java:1240) at org.jetbrains.kotlin.utils.PluginUtilsKt.decodePluginOptions(pluginUtils.kt:39) at org.jetbrains.kotlin.kapt3.Kapt3CommandLineProcessor.processOption(Kapt3Plugin.kt:73) at org.jetbrains.kotlin.cli.jvm.plugins.PluginCliParserKt.processCompilerPluginsOptions(PluginCliParser.kt:125) at org.jetbrains.kotlin.cli.jvm.plugins.PluginCliParser.processPluginOptions(PluginCliParser.kt:83) at org.jetbrains.kotlin.cli.jvm.plugins.PluginCliParser.loadPlugins(PluginCliParser.kt:72) at org.jetbrains.kotlin.cli.jvm.plugins.PluginCliParser.loadPluginsSafe(PluginCliParser.kt:44) at org.jetbra异常: java.base/java.io.ObjectInputStream$BlockDataInputStream.readUTFSpan(ObjectInputStream.java:3752) 处的 java.io.UTFDataFormatException 在 java.base/java.io.ObjectInputStream$BlockDataInputStream.readUTFBody(ObjectInputStream.java:3677) 处java.base/java.io.ObjectInputStream$BlockDataInputStream.readUTF(ObjectInputStream.java:3477) at java.base/java.io.ObjectInputStream.readUTF(ObjectInputStream.java:1240) at org.jetbrains.kotlin.utils.PluginUtilsKt。位于 org.jetbrains.kotlin.kapt3.Kapt3CommandLineProcessor.processOption(Kapt3Plugin.kt:73) 的 decodePluginOptions(pluginUtils.kt:39) 位于 org.jetbrains.kotlin.cli.jvm.plugins.PluginCliParserKt.processParserKt.processParserPlugintCOptions(PlugintC2)在 org.jetbrains.kotlin.cli.jvm.plugins.PluginCliParser.processPluginOptions(PluginCliParser.kt:83) 在 org.jetbrains.kotlin.cli.jvm.plugins.PluginCliParser.loadPlugins(PluginCliParser.kt:72) 在.kotlin.cli.jvm.plugins.PluginCliParser.loadPluginsSafe(PluginCliParser.kt:44) 在 org.jetbra ins.kotlin.cli.common.CLICompiler.loadPlugins(CLICompiler.kt:179) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:69) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:52) at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:88) at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44) at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98) at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:76) at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:45) at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMainNoExit(CLITool.kt:227) at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMainNoExit$default(CLITool.kt:222) at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMain(CLITool.kt:214) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler$Companion.main(K2JVMCompiler.kt:271) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.main(K2JVMCompiler.kt) ins.kotlin.cli.common.CLICompiler.loadPlugins(CLICompiler.kt:179) 在 org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:69) 在 org.jetbrains.kotlin.cli.jvm。 K2JVMCompiler.doExecute(K2JVMCompiler.kt:52) at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:88) at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt: 44) 在 org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98) 在 org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:76) 在 org.jetbrains.kotlin .cli.common.CLITool.exec(CLITool.kt:45)​​ 在 org.jetbrains.kotlin.cli.common.CLITool$Companion.doMainNoExit(CLITool.kt:227) 在 org.jetbrains.kotlin.cli.common.CLITool $Companion.doMainNoExit$default(CLITool.kt:222) at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMain(CLITool.kt:214) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler$Companion .main(K2JVMCompiler.kt:271) 在 org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.main(K2JVMCompiler.kt)

Task :cca-app:kaptGenerateStubsDebugKotlin FAILED任务 :cca-app:kaptGenerateStubsDebugKotlin 失败

FAILURE: Build failed with an exception. FAILURE:构建失败,出现异常。

  • What went wrong: Execution failed for task ':cca-app:kaptGenerateStubsDebugKotlin'.出了什么问题:任务“:cca-app:kaptGenerateStubsDebugKotlin”的执行失败。

Compilation error.编译错误。 See log for more details查看日志了解更多详情

  • Try: Run with --info or --debug option to get more log output.尝试:使用 --info 或 --debug 选项运行以获得更多日志输出。 Run with --scan to get full insights.使用 --scan 运行以获得完整的见解。

  • Get more help at https://help.gradle.orghttps://help.gradle.org获取更多帮助

BUILD FAILED in 5s 27 actionable tasks: 2 executed, 25 up-to-date BUILD 在 5 秒内失败 27 个可操作的任务:2 个已执行,25 个是最新的


Compose is 1.0.4, Kotlin Gradle plugin is 1.6.0-M1, Gradle build tools is 4.2.2 Compose 是 1.0.4,Kotlin Gradle 插件是 1.6.0-M1,Gradle 构建工具是 4.2.2


When I remove the compose dependencies, the project is successfully assembled I tried to change the compose and kotlin versions, but it did not give any result当我删除 compose 依赖项时,项目已成功组装我尝试更改 compose 和 kotlin 版本,但没有给出任何结果

You're using the wrong version of Kotlin and the Gradle plugin.您使用了错误版本的 Kotlin 和 Gradle 插件。 Use:用:

Kotlin: 1.5.31 
Gradle plugin: 7.0.3

You should upgrade your Android Studio to the latest version.您应该将您的 Android Studio 升级到最新版本。 It provides better notifications about dependency versions and lets you upgrade your dependencies much better than in older versions of Android Studio.它提供了关于依赖项版本的更好的通知,并让您比旧版本的 Android Studio 更好地升级您的依赖项。

1.6.0-M1 is your problem. 1.6.0-M1是你的问题。 Compose is closely tied to the Kotlin compiler, and version 1.0.4 will work with Kotlin 1.5.21 . Compose 与 Kotlin 编译器紧密相关, 1.0.4版将与 Kotlin 1.5.21

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM