dpa99c / cordova-plugin-firebasex

Cordova plugin for Google Firebase
MIT License
572 stars 470 forks source link

firebasex 16.4.0 caused kotlin version error #865

Open gouteru opened 9 months ago

gouteru commented 9 months ago

Bug report

CHECKLIST

Current behavior:

When update cordova-plugin-firebasex 16.1.0 to 16.4.0, cordova build android failed with the following errors. Finally, I gave up and revert to 16.1.0.

cordova build android
cordova-plugin-androidx-adapter: Processed 48 source files in 673ms
cordova-plugin-firebasex: Preparing Firebase on Android
Checking Java JDK and Android SDK versions
ANDROID_HOME=/Users/me/Library/Android/sdk (recommended setting)
ANDROID_SDK_ROOT=undefined (DEPRECATED)
Using Android SDK: /Users/me/Library/Android/sdk
Subproject Path: CordovaLib
Subproject Path: app

> Configure project :app
Warning: The 'kotlin-android-extensions' Gradle plugin is deprecated. Please use this migration guide (https://goo.gle/kotlin-android-extensions-deprecation) to start working with View Binding (https://developer.android.com/topic/libraries/view-binding) and the 'kotlin-parcelize' plugin.
strippedNativeLibsDir is deprecated and no longer used. Please remove it from your build configuration.

> Task :app:compileDebugKotlin FAILED
**e: /Users/me/.gradle/caches/transforms-3/1ee3f7841abe9979797edc39b62bd26a/transformed/jetified-firebase-auth-22.2.0-api.jar!/META-INF/java.com.google.android.gmscore.integ.client.firebase-auth-api_firebase-auth-api.kotlin_module:
 Module was compiled with an incompatible version of Kotlin. 
 The binary version of its metadata is 1.9.0, expected version is 1.7.1.
e: /Users/me/.gradle/caches/transforms-3/dade25bead44bca314189166709326d8/transformed/jetified-play-services-measurement-api-21.5.0-api.jar!/META-INF/java.com.google.android.gmscore.integ.client.measurement_api_measurement_api.kotlin_module:
 Module was compiled with an incompatible version of Kotlin.
 The binary version of its metadata is 1.9.0, expected version is 1.7.1.**

FAILURE: Build failed with an exception.

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

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

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

See https://docs.gradle.org/7.6/userguide/command_line_interface.html#sec:command_line_warnings

Expected behavior:

kotlin 1.9 seems to require Gradle 8 which is not yet supported with cordova-android.

Environment information

Installed platforms:

android 12.0.1 ios 6.3.0

Installed plugins

cordova-plugin-android-dark-mode-support 2.0.0 "AndroidDarkModeSupport" cordova-plugin-androidx-adapter 1.1.3 "cordova-plugin-androidx-adapter" cordova-plugin-badge 0.8.9 "Badge" cordova-plugin-calendar 5.1.6 "Calendar" cordova-plugin-file 6.0.2 "File" cordova-plugin-firebasex 16.1.0 "Google Firebase Plugin" cordova-plugin-inappbrowser 5.0.0 "InAppBrowser" cordova-plugin-splashscreen 6.0.2 "Splashscreen" cordova-plugin-statusbar 3.0.0 "StatusBar" cordova-plugin-webviewcolor 2.2.0 "WebView background color plugin" cordova-plugin-wkwebview-file-xhr 3.1.0 "Cordova WKWebView File XHR Plugin" cordova.plugins.diagnostic 7.1.2 "Diagnostic"

OS

MacOS 14.3, Xcode 15.1

TheNotorius0 commented 9 months ago

I've got the same error, and I resolved it with the following steps:

On config.xml:

<preference name="GradlePluginKotlinEnabled" value="true" />
<preference name="GradlePluginKotlinVersion" value="1.9.0" />

Then, on \platforms\android\app\build.gradle:

Delete the line 24: apply plugin: 'kotlin-android-extensions'

I've created a Cordova hook so I don't have to manually delete the line everytime I add or remove the android platform. This is just temporary solution until cordova-13 arrives (that line will be automatically removed in cordova-13).