简体   繁体   中英

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. 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 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)

Task :cca-app:kaptGenerateStubsDebugKotlin FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':cca-app:kaptGenerateStubsDebugKotlin'.

Compilation error. See log for more details

  • Try: Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 5s 27 actionable tasks: 2 executed, 25 up-to-date


Compose is 1.0.4, Kotlin Gradle plugin is 1.6.0-M1, Gradle build tools is 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

You're using the wrong version of Kotlin and the Gradle plugin. Use:

Kotlin: 1.5.31 
Gradle plugin: 7.0.3

You should upgrade your Android Studio to the latest version. It provides better notifications about dependency versions and lets you upgrade your dependencies much better than in older versions of Android Studio.

1.6.0-M1 is your problem. Compose is closely tied to the Kotlin compiler, and version 1.0.4 will work with Kotlin 1.5.21 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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