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
499 stars 214 forks source link

Compiles with errors when with google maps plugin #405

Open piernik opened 4 years ago

piernik commented 4 years ago

With ionic clean sidemenu project I have both Your plugin and Google Maps plugin (https://github.com/mapsplugin/cordova-plugin-googlemaps). It does not compile without errors.

Both plugins have PLAY_SERVICES_VERSION@15.0.1.

Here ares install commands:

ionic cordova plugin add cordova-plugin-admob-free --save --variable ADMOB_APP_ID="ca-app-pub-x~x" --variable PLAY_SERVICES_VERSION="15.0.1"
ionic cordova plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="xxx" --variable PLAY_SERVICES_VERSION="15.0.1"

And errors: maps-admob

santekotturi commented 4 years ago

@piernik I had the same issue. I resolved it (maybe just temporarily) using this plugin which pegs the Play Services versions.

I tried a bunch of options but in the end, I had to peg all of the services I'm using (auth for login & this for ads, I'm not using google maps but hopefully this works for you).

cordova plugin add cordova-android-play-services-gradle-release  --variable play-services-ads=15.0.1 --variable play-services-auth=15.0.1 --variable play-services-base=15.0.1  --variable play-services-identity=15.0.1 

to get the full list of services: https://www.npmjs.com/package/cordova-android-play-services-gradle-release#component-versions

you'll probably just need to add --variable play-services-maps=15.0.1

I finally got my app to compile and the plugin is working on my end 🤘🏼

EDIT: To get the full list of services your app is using, run cordova build android and the plugin above will list all of them out. If I didn't set them all to 15.0.1, then some where being set to 17, others to 18. This is what my logs look like now but you can see the list of what your app is using and then just reinstall the plugin specifying all of them to 15.0.1. Hope it helps!

> cordova build android
cordova-android-play-services-gradle-release: overriding com.google.android.gms:play-services-ads:11.0.4 in build.gradle with com.google.android.gms:play-services-ads:15.0.1
cordova-android-play-services-gradle-release: overriding com.google.android.gms:play-services-base:11.0.4 in build.gradle with com.google.android.gms:play-services-base:15.0.1
cordova-android-play-services-gradle-release: overriding com.google.android.gms:play-services-ads:11.0.4 in build.gradle with com.google.android.gms:play-services-ads:15.0.1
cordova-android-play-services-gradle-release: overriding com.google.android.gms:play-services-base:11.0.4 in build.gradle with com.google.android.gms:play-services-base:15.0.1
piernik commented 4 years ago

Great! It's working. I also needed to add --variable play-services-location=15.0.1. Source of that problem is that despite ionic cordova plugin add cordova-plugin-admob-free --save --variable ADMOB_APP_ID="ca-app-pub-x~x" --variable PLAY_SERVICES_VERSION="15.0.1" admob-free depends on version 11.0.4.

Thanks for help!