[Android][Cordova] class file for kotlin.jvm.functions.Function1 not found

Seltzer Wang
Aug 10, 2021

編譯 Android版本時出現這個訊息,代表可能沒有正確引入 kotlin 的核心,找找看在 app/build.gradle 的 dependencies 中是否有

dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')

if (cdvHelpers.getConfigPreference('GradlePluginKotlinEnabled', 'false').toBoolean()) {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

// SUB-PROJECT DEPENDENCIES START
implementation(project(path: ":CordovaLib"))
implementation "androidx.core:core-ktx:+" <--- 這行
implementation "com.google.firebase:firebase-core:+"
implementation "com.google.firebase:firebase-messaging:+"
// SUB-PROJECT DEPENDENCIES END
}

加入這行編譯才不會出錯

--

--