Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GradlePluginKotlinEnabled (deprecated) and cordova-plugin-firebasex (Task :app:compileDebugKotlin FAILED) #646

Open
TheNotorius0 opened this issue Jan 8, 2024 · 2 comments

Comments

@TheNotorius0
Copy link

Describe the bug
In order to use admob-plus-cordova, you need to set Kotlin in the config.xml: <preference name="GradlePluginKotlinEnabled" value="true" />. It seems deprecated though:

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 'kot
lin-parcelize' plugin.

Now, since it's a warning, we could ignore it, admob on itself work great and it's awesome. But if you are also using cordova-plugin-firebasex and try to compile (cordova build android) things get messy:

Task :app:compileDebugKotlin FAILED
e: C:/Users/sevan/.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 inc
ompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
e: C:/Users/sevan/.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

To Reproduce
cordova plugin add admob-plus-cordova
cordova plugin cordova-plugin-firebasex
cordova build android
Task :app:compileDebugKotlin FAILED

Expected behavior
Both plugins should work without failing to compile. I guess that since "GradlePluginKotlinEnabled" is deprecated, it's admob-plus that should fix this issue, but I'm not a Kotlin expert.

Additional context
The Task :app:compileDebugKotlin FAILED only started to happen after cordova-plugin-firebasex@16.2.0 (I'm still using cordova-plugin-firebasex@16.1.0 and it compiles).

@TheNotorius0
Copy link
Author

Update:

I have been able to make admob-plus cordova and cordova-plugin-firebasex work together with the following changes:

<preference name="GradlePluginKotlinVersion" value="1.9.0" /> in config.xml
Deleted the row apply plugin: 'kotlin-android-extensions' in app/build.gradle (line 24).

Keep in mind that, with Kotlin 1.9, it gives me the following warnings now:

> Task :app:compileDebugKotlin
w: file:///C:/Users/sevan/WebstormProjects/Azmar/platforms/android/app/src/main/kotlin/admob/plus/cordova/AdMob.kt:102:23 'enableSameAppKey(Boolean): Unit' is deprecated. Deprecated in Java
w: file:///C:/Users/sevan/WebstormProjects/Azmar/platforms/android/app/src/main/kotlin/admob/plus/cordova/ads/Banner.kt:33:40 'SMART_BANNER: AdSize' is deprecated. Deprecated in Java
w: file:///C:/Users/sevan/WebstormProjects/Azmar/platforms/android/app/src/main/kotlin/admob/plus/cordova/ads/Banner.kt:34:17 'when' is exhaustive so 'else' is redundant here
w: file:///C:/Users/sevan/WebstormProjects/Azmar/platforms/android/app/src/main/kotlin/admob/plus/cordova/ads/Banner.kt:296:9 Visibility modifiers are redundant in getter
w: file:///C:/Users/sevan/WebstormProjects/Azmar/platforms/android/app/src/main/kotlin/admob/plus/cordova/ads/Banner.kt:309:44 'SMART_BANNER: AdSize' is deprecated. Deprecated in Java
w: file:///C:/Users/sevan/WebstormProjects/Azmar/platforms/android/app/src/main/kotlin/admob/plus/cordova/ads/Banner.kt:310:21 'when' is exhaustive so 'else' is redundant here
w: file:///C:/Users/sevan/WebstormProjects/Azmar/platforms/android/app/src/main/kotlin/admob/plus/core/util.kt:25:34 Type mismatch: inferred type is Nothing? but String was expected
w: file:///C:/Users/sevan/WebstormProjects/Azmar/platforms/android/app/src/main/kotlin/admob/plus/core/util.kt:25:39 Unnecessary safe call on a non-null receiver of type String!
w: file:///C:/Users/sevan/WebstormProjects/Azmar/platforms/android/app/src/main/kotlin/admob/plus/core/util.kt:29:31 Type mismatch: inferred type is Nothing? but String was expected
w: file:///C:/Users/sevan/WebstormProjects/Azmar/platforms/android/app/src/main/kotlin/admob/plus/core/util.kt:29:36 Unnecessary safe call on a non-null receiver of type String!
w: file:///C:/Users/sevan/WebstormProjects/Azmar/platforms/android/app/src/main/kotlin/admob/plus/core/util.kt:39:23 'SMART_BANNER: AdSize' is deprecated. Deprecated in Java
w: file:///C:/Users/sevan/WebstormProjects/Azmar/platforms/android/app/src/main/kotlin/admob/plus/core/util.kt:44:33 'SMART_BANNER: AdSize' is deprecated. Deprecated in Java
w: file:///C:/Users/sevan/WebstormProjects/Azmar/platforms/android/app/src/main/kotlin/admob/plus/core/util.kt:87:42 Type mismatch: inferred type is Nothing? but String was expected
w: file:///C:/Users/sevan/WebstormProjects/Azmar/platforms/android/app/src/main/kotlin/admob/plus/core/util.kt:87:47 Unnecessary safe call on a non-null receiver of type String!

@1n3JgKl9pQ6cUMrW
Copy link
Contributor

Thanks for the heads up.

I guess you are using the beta-version of the Admob-plugin?

The regular / stable version doesn't need this adjustments (I am using both for a couple of years know).

As a reminder, for others, keep in mind the AndroidX "switch" when enabling similar problems;

https://admob-plus.github.io/docs/cordova/installation

image

AndroidX is out there for a long time, but not enabling or (or even enabling it) can cause issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants