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

Cannot change SDK version #448

Closed codenfast closed 3 years ago

codenfast commented 3 years ago

Hi, im just installed plugin and trying on Android 5.1 (API 22)

Application runs successfully but, when i try to show test ads, application is crashing.

installed with;

cordova plugin add cordova-plugin-admob-free --save --variable ADMOB_APP_ID="ca-app-pub-xxxxxxxxxx~xxxxxxxx"

cordova run android

It's okey loaded

console (chrome) is show a warning;

**DevTools failed to load SourceMap: Could not load content for file:///android_asset/www/plugins/cordova-plugin-admob-free/www/admob.js.map: System error: net::ERR_FILE_NOT_FOUND**

and i try to run;

admob.interstitial.config({
 id: 'ca-app-pub-xxxxxxx/xxxxxx',
});

and

admob.interstitial.prepare()

java.lang.NoClassDefFoundError: com.google.android.gms.internal.zzup at com.google.android.gms.internal.zzlc.(Unknown Source) at com.google.android.gms.internal.zzlc.(Unknown Source) at com.google.android.gms.internal.zzlc.(Unknown Source) at com.google.android.gms.ads.BaseAdView.(Unknown Source) at com.google.android.gms.ads.AdView.(Unknown Source) at name.ratson.cordova.admob.banner.BannerExecutor$1.run(BannerExecutor.java:70) at android.os.Handler.handleCallback(Handler.java:815) at android.os.Handler.dispatchMessage(Handler.java:104) at android.os.Looper.loop(Looper.java:194) at android.app.ActivityThread.main(ActivityThread.java:5653) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

....Application crashed!

There is a problem with Google Services

I can see problem on gradle;

implementation "com.google.android.gms:play-services-auth:15.0.1"
implementation "com.google.android.gms:play-services-ads:11.0.4"

Problem is difference version of google play services, Ok, you documented "how to change sdk version", but i put config;

<plugin name="cordova-admob-sdk" spec="../plugins/cordova-admob-sdk">
    <variable name="PLAY_SERVICES_VERSION" value="15.0.1" />
</plugin>

Gradle still same problem. Any Suggest ?

Also tried, config.xml

codenfast commented 3 years ago

Solved by file manupulate; \plugins\cordova-admob-sdk\plugin.xml

changed <preference name="PLAY_SERVICES_VERSION" default="15.0.1"/>

because i need version 15.0.1

cordova platform remove android
cordova platform add android

I'm tested and works well. Please fix your plugin