Open TheNotorius0 opened 4 months ago
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!
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
AndroidX is out there for a long time, but not enabling or (or even enabling it) can cause issues.
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: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:
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).