ratson / cordova-plugin-admob-free

New development has been moved to "admob-plus-cordova", https://github.com/admob-plus/admob-plus/tree/master/packages/cordova
https://github.com/admob-plus/admob-plus
MIT License
494 stars 210 forks source link

On adding cordova-plugin-admob-free@0.27.0, app install successfully but crashes on android device after installation. #474

Open Astha-Anand opened 3 years ago

Astha-Anand commented 3 years ago

We are using cordova-plugin-admob-free latest version in the app. After adding the plugin app crashes on android device. App build and installed successfully on device but crashes on opening.

Version details: Ionic - 6.10.1 cordova - 9.0.0 (cordova-lib@9.0.1) "cordova-android": "^9.0.0",

Admob plugin details: "cordova-plugin-admob-free": "^0.27.0", "cordova-admob-sdk": "^0.24.1", "@ionic-native/admob-free": "^5.31.1",

Firebasex plugin verion: "cordova-plugin-firebasex": "^11.0.3"

I have tried multiple solutions but no luck.Can you please look into this issue.

Giuliopretis commented 3 years ago

Same problem here, android studio gives me two errors:

BrokerBisiako87 commented 3 years ago

I also have the same problem. I added the plugin "cordova-plugin-firebasex" (dpa99c version 11.0.3) and then the plugin cordova-plugin-admob-free (ratson v0.27.0) in my cordova project. The plugins installed together conflict, perhaps the cause is to be seen with gradle config ??? I am using cordova@10 , android@9.0.0 , Gradle 6.8.2 , JVM 1.8.0_281 (Oracle Corporation 25.281-b09). When I downloaded the ADMOB plugin, and then compiled with "cordova build android --debug", the same error as @Giuliopretis came out. I solved it by installing the following plugins: cordova-plugin-androidx and cordova-plugin-androidx-adapter, but after successful compilation, installing the apk with adb -s SAMSUNG install -t. \ App-debug.apk, after crashes after startup.

Giuliopretis commented 3 years ago

@BrokerBisiako87 I found out a solution. The problem is that this package is not updated since 2 years, the developer made a "new version" of this package: https://github.com/admob-plus/admob-plus I would recommend to use that versione instead of this one.

To use this you have to install cordova-plugin-androidx, as you've already done, and change the import to androidx.annotation.NonNull

Then you have to update all the dependencies implementation of google services in the gradle file at the last version. You can find them on google documentation. And then I managed to make it work.

BrokerBisiako87 commented 3 years ago

Hi @Giuliopretis , thanks for the information. I was just integrating the new "admob-plus-cordova" package. I saw that in the cordova-plugin-admob-free GitHub repository it writes: "Please use admob-plus if possible". The update dates back to 24h ago. I have not installed cordova-plugin-androidx, if I use Android@9.0.0. is already integrated, just enter the following information in the config.xml

<platform name="android">
<preference name="AndroidXEnabled" value="true" />
</platform>