close
近期要引用 kotlin 到 java 開發的 Android 專案中,遇到了下述問題:
java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics; |
解決方法就是在 build.gradle(Project:xxx)底下加入:
ext.kotlin_version= '1.3.72'
|
完整build.gradle
並且在 build.gradle(Module:app)底下加入:
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
如果沒有寫 ext.kotlin_version,反而會新增下述錯誤資訊:
ERROR: Could not get unknown property 'kotlin_version' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Reference:
https://stackoverflow.com/questions/45397802/kotlin-start-application-crash/47684159
https://stackoverflow.com/questions/64834818/android-studio-could-not-get-unknown-property-kotlin-version
全站熱搜
留言列表