Heyzap / heyzap-cordova

Heyzap SDK for Apache Cordova
https://www.heyzap.com/
10 stars 18 forks source link

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/GoogleApiAvailability; #37

Closed ccorcos closed 6 years ago

ccorcos commented 6 years ago

I upgraded my android libs to the latest in Android studio and got rid of the Crosswalk plugin I was using and now I'm hitting this error:

03-26 22:52:08.102 10386-10907/chetball.id E/Heyzap: Heyzap has encountered an error and is shutting down.
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/GoogleApiAvailability;
        at com.heyzap.sdk.mediation.adapter.AdmobAdapter.getMarketingVersion(AdmobAdapter.java:76)
        at com.heyzap.mediation.handler.MediationEventReporter.createParams(MediationEventReporter.java:178)
        at com.heyzap.mediation.handler.MediationEventReporter.sendFetchResults(MediationEventReporter.java:37)
        at com.heyzap.mediation.MediationManager$2$1.run(MediationManager.java:160)
        at com.heyzap.mediation.MediationManager$2$1.run(MediationManager.java:151)
        at com.heyzap.common.concurrency.FutureUtils$FutureRunnable.run(FutureUtils.java:136)
        at com.heyzap.common.concurrency.WrappedRunnable.run(WrappedRunnable.java:26)
        at com.heyzap.common.concurrency.WrappedRunnable.run(WrappedRunnable.java:26)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.GoogleApiAvailability" on path: DexPathList[[zip file "/data/app/chetball.id-t26LYUwSTkwH-ZobDoAiRg==/base.apk", zip file "/data/app/chetball.id-t26LYUwSTkwH-ZobDoAiRg==/split_lib_dependencies_apk.apk", zip file "/data/app/chetball.id-t26LYUwSTkwH-ZobDoAiRg==/split_lib_slice_0_apk.apk", zip file "/data/app/chetball.id-t26LYUwSTkwH-ZobDoAiRg==/split_lib_slice_1_apk.apk", zip file "/data/app/chetball.id-t26LYUwSTkwH-ZobDoAiRg==/split_lib_slice_2_apk.apk", zip file "/data/app/chetball.id-t26LYUwSTkwH-ZobDoAiRg==/split_lib_slice_3_apk.apk", zip file "/data/app/chetball.id-t26LYUwSTkwH-ZobDoAiRg==/split_lib_slice_4_apk.apk", zip file "/data/app/chetball.id-t26LYUwSTkwH-ZobDoAiRg==/split_lib_slice_5_apk.apk", zip file "/data/app/chetball.id-t26LYUwSTkwH-ZobDoAiRg==/split_lib_slice_6_apk.apk", zip file "/data/app/chetball.id-t26LYUwSTkwH-ZobDoAiRg==/split_lib_slice_7_apk.apk", zip file "/data/app/chetball.id-t26LYUwSTkwH-ZobDoAiRg==/split_lib_slice_8_apk.apk", zip file "/data/app/chetball.id-t26LYUwSTkwH-ZobDoAiRg==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/chetball.id-t26LYUwSTkwH-ZobDoAiRg==/lib/arm64, /system/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at com.heyzap.sdk.mediation.adapter.AdmobAdapter.getMarketingVersion(AdmobAdapter.java:76) 
        at com.heyzap.mediation.handler.MediationEventReporter.createParams(MediationEventReporter.java:178) 
        at com.heyzap.mediation.handler.MediationEventReporter.sendFetchResults(MediationEventReporter.java:37) 
        at com.heyzap.mediation.MediationManager$2$1.run(MediationManager.java:160) 
        at com.heyzap.mediation.MediationManager$2$1.run(MediationManager.java:151) 
        at com.heyzap.common.concurrency.FutureUtils$FutureRunnable.run(FutureUtils.java:136) 
        at com.heyzap.common.concurrency.WrappedRunnable.run(WrappedRunnable.java:26) 
        at com.heyzap.common.concurrency.WrappedRunnable.run(WrappedRunnable.java:26) 
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) 
        at java.lang.Thread.run(Thread.java:764) 
ezpuzz commented 6 years ago

make sure you include the heyzap-cordova-admob plugin as well as the base plugin, it is required.

if you have many third party networks you may also need to enable multidex using gradle.. you can use a plugin such as this one: https://www.npmjs.com/package/cordova-plugin-enable-multidex

ccorcos commented 6 years ago

Hey @ezpuzz, I added multidex and it appears to build with it, but it didn't solve that build error. I have a pretty simple list of dependencies here (including admob). Not sure what to try (I'm not that familiar with Java / Android).

    <engine name="ios" spec="^4.5.4" />
    <engine name="android" spec="^6.4.0" />
    <plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
    <plugin name="cordova-plugin-wkwebview-engine" spec="^1.1.4" />
    <plugin name="heyzap-cordova-admob" spec="https://github.com/Heyzap/heyzap-cordova-admob.git" />
    <plugin name="heyzap-cordova" spec="https://github.com/Heyzap/heyzap-cordova.git" />
    <plugin name="heyzap-cordova-applovin" spec="https://github.com/Heyzap/heyzap-cordova-applovin.git" />
    <plugin name="heyzap-cordova-facebook_audience_network" spec="https://github.com/Heyzap/heyzap-cordova-facebook_audience_network.git" />
    <plugin name="cordova-plugin-inapppurchase" spec="^1.1.0" />
    <plugin name="cordova-plugin-apprate" spec="^1.3.0" />
    <plugin name="cordova-plugin-taptic-engine" spec="^2.1.0" />
    <plugin name="cordova-plugin-vibration" spec="^3.0.1" />
    <plugin name="cordova-plugin-device" spec="^2.0.1" />
    <plugin name="cordova-plugin-camera" spec="^4.0.2" />
    <plugin name="cordova-plugin-enable-multidex" spec="~0.1.3" />
ezpuzz commented 6 years ago

make sure your local android sdk installation is up to date, use the android sdk manager to update to the latest stable version of the google repository. this error occurs when the google-play-services-ads library is out of date.

ccorcos commented 6 years ago

hey @ezpuzz thanks for the help. sdkmanager --upgrade did the trick for me :)