mlc-llm [Bug] mlc4j:编译Kotlin调试版本失败,以下类的上层类型无法解析

v440hwme  于 5个月前  发布在  Kotlin
关注(0)|答案(1)|浏览(110)

当运行./gradlew assembleDebug时,出现错误:

> Task :mlc4j:compileDebugKotlin FAILED
e: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
    class ai.mlc.mlcllm.JSONFFIEngine, unresolved supertypes: Object
    class ai.mlc.mlcllm.JSONFFIEngine.KotlinFunction, unresolved supertypes: Object
    class kotlin.Pair, unresolved supertypes: java.io.Serializable
    class org.apache.tvm.TVMValue, unresolved supertypes: java.lang.Object
Adding -Xextended-compiler-checks argument might provide additional information.

e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:12:13 Unresolved reference: util
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:13:13 Unresolved reference: util
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:18:9 Cannot access class 'java.lang.Thread'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:18:9 Cannot access class 'java.lang.ClassLoader'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:36:23 Cannot access 'java.lang.Object' which is a supertype of 'ai.mlc.mlcllm.JSONFFIEngine'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:37:34 Cannot access class 'String'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:37:34 Type mismatch: inferred type is String! but kotlin.String? was expected
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:41:13 Unresolved reference: Thread
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:41:36 Variable expected
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:41:47 Unresolved reference: Thread
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:42:27 Cannot access 'java.lang.Object' which is a supertype of 'ai.mlc.mlcllm.JSONFFIEngine'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:46:27 Cannot access 'java.lang.Object' which is a supertype of 'ai.mlc.mlcllm.JSONFFIEngine'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:64:23 Cannot access class 'String'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:64:23 Cannot access 'java.lang.Object' which is a supertype of 'ai.mlc.mlcllm.JSONFFIEngine'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:64:30 Type mismatch: inferred type is kotlin.String but String! was expected
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:68:23 Cannot access 'java.lang.Object' which is a supertype of 'ai.mlc.mlcllm.JSONFFIEngine'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:72:23 Cannot access 'java.lang.Object' which is a supertype of 'ai.mlc.mlcllm.JSONFFIEngine'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:83:26 Unresolved reference: Logger
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:83:62 Cannot access class 'java.lang.Class'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:83:67 Unresolved reference: name
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:92:25 Unresolved reference: UUID
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:97:23 Cannot access class 'String'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:97:23 Cannot access 'java.lang.Object' which is a supertype of 'ai.mlc.mlcllm.JSONFFIEngine'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:97:38 Type mismatch: inferred type is kotlin.String but String! was expected
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:112:77 Cannot access 'java.io.Serializable' which is a supertype of 'kotlin.Boolean'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:128:18 Type mismatch: inferred type is kotlin.Exception /* = java.lang.Exception */ but Throwable was expected
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:129:56 Cannot access class 'java.lang.Exception'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:170:13 Cannot access 'java.io.Serializable' which is a supertype of 'kotlin.Boolean'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/MLCEngine.kt:171:19 Unresolved reference: IllegalArgumentException
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/OpenAIProtocol.kt:17:13 Unresolved reference: util
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/OpenAIProtocol.kt:66:26 Unresolved reference: UUID
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/OpenAIProtocol.kt:71:5 Cannot access 'java.io.Serializable' which is a supertype of 'ai.mlc.mlcllm.OpenAIProtocol.ChatCompletionRole'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/OpenAIProtocol.kt:73:9 Cannot access 'java.io.Serializable' which is a supertype of 'ai.mlc.mlcllm.OpenAIProtocol.ChatCompletionRole.system'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/OpenAIProtocol.kt:74:9 Cannot access 'java.io.Serializable' which is a supertype of 'ai.mlc.mlcllm.OpenAIProtocol.ChatCompletionRole.user'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/OpenAIProtocol.kt:75:9 Cannot access 'java.io.Serializable' which is a supertype of 'ai.mlc.mlcllm.OpenAIProtocol.ChatCompletionRole.assistant'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/OpenAIProtocol.kt:76:9 Cannot access 'java.io.Serializable' which is a supertype of 'ai.mlc.mlcllm.OpenAIProtocol.ChatCompletionRole.tool'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/OpenAIProtocol.kt:88:25 Cannot access 'java.io.Serializable' which is a supertype of 'kotlin.String'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/OpenAIProtocol.kt:96:56 Cannot access 'java.io.Serializable' which is a supertype of 'kotlin.String'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/OpenAIProtocol.kt:117:91 Cannot access 'java.io.Serializable' which is a supertype of 'kotlin.String'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/OpenAIProtocol.kt:123:31 Unresolved reference: IllegalStateException
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/OpenAIProtocol.kt:153:38 Cannot access 'java.io.Serializable' which is a supertype of 'kotlin.Float'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/OpenAIProtocol.kt:154:28 Cannot access 'java.io.Serializable' which is a supertype of 'kotlin.String'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/OpenAIProtocol.kt:156:37 Cannot access 'java.io.Serializable' which is a supertype of 'kotlin.Float'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/OpenAIProtocol.kt:158:32 Cannot access 'java.io.Serializable' which is a supertype of 'kotlin.String'. Check your module classpath for missing or conflicting dependencies
e: file:///share/Repository/mlc-llm/android/MLCChat/dist/lib/mlc4j/src/main/java/ai/mlc/mlcllm/OpenAIProtocol.kt:160:28 Cannot access 'java.io.Serializable' which is a supertype of 'kotlin.String'. Check your module classpath for missing or conflicting dependencies

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':mlc4j:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

* Try:
> Run with --stacktrace option to get the stack trace.
> 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.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.5/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 5s
32 actionable tasks: 15 executed, 17 up-to-date

JDK版本:jdk-17.0.11

1wnzp6jl

1wnzp6jl1#

请遵循Android SDK文档 https://llm.mlc.ai/docs/deploy/android.html
这可能与JDK版本和设置有关。您需要使用NDK附带的JDK。我们强烈建议将JAVA_HOME设置为与Android Studio捆绑的JDK。

相关问题