danwilson / google-analytics-plugin

Cordova (PhoneGap) Plugin to connect to the native Google's Universal Analytics SDK 3.0
MIT License
693 stars 500 forks source link

Problems on included libraries with 1.8.6 and java.lang.NoClassDefFoundError #534

Open mathatan opened 5 years ago

mathatan commented 5 years ago

We're experiencing a strange issue with 1.8.6 where the builds work perfectly fine and even install from apk to device performs as expected, but when installing from Google Play Store app crashes on first run to java.lang.NoClassDefFoundError.

We've identified that downgrading google-analytics-plugin to 1.8.3 fixes the issue. Setting GMS_VERSION variable has in config.xml for 1.8.6 has no effect. This issue persist on multiple android platforms and there seems to be no connecting factor besides the plugin and install from Play Store.

The Google Play Store error throw log is:

java.lang.NoClassDefFoundError: 
  at com.google.android.gms.internal.zzami.zzaf (Unknown Source)
  at com.google.android.gms.analytics.CampaignTrackingReceiver.onReceive (Unknown Source)
  at android.app.ActivityThread.handleReceiver (ActivityThread.java:3390)
  at android.app.ActivityThread.-wrap18 (Unknown Source)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1780)
  at android.os.Handler.dispatchMessage (Handler.java:105)
  at android.os.Looper.loop (Looper.java:164)
  at android.app.ActivityThread.main (ActivityThread.java:6938)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)
Caused by: java.lang.ClassNotFoundException: 
  at dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:93)
  at java.lang.ClassLoader.loadClass (ClassLoader.java:379)
  at java.lang.ClassLoader.loadClass (ClassLoader.java:312)

Android studio is using the currently available libraries with the exception of NDK version which is 16b (this is to enable building of Android platform 6.4.0)

OS: MacOS High Sierra 10.13.6 Cordova version 8.0.0 Android platform version 6.4.0 Plugins:

branch-cordova-sdk 3.0.0 "branch-cordova-sdk"
card.io.cordova.mobilesdk 2.1.0 "CardIO"
com.paypal.cordova.mobilesdk 3.5.0 "PayPalMobile"
com.verso.cordova.clipboard 0.1.0 "Clipboard"
cordova-plugin-apprate 1.4.0 "AppRate"
cordova-plugin-appsflyer-sdk 4.2.23 "AppsFlyer"
cordova-plugin-customurlscheme 4.3.0 "Custom URL scheme"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-facebook4 2.2.0 "Facebook Connect"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-globalization 1.11.0 "Globalization"
cordova-plugin-inappbrowser 3.0.0 "InAppBrowser"
cordova-plugin-insomnia 4.3.0 "Insomnia (prevent screen sleep)"
cordova-plugin-ionic-keyboard 2.1.2 "cordova-plugin-ionic-keyboard"
cordova-plugin-multidex 0.1.2 "Cordova Multi Dex"
cordova-plugin-nativeaudio 3.0.9 "Cordova Native Audio"
cordova-plugin-nativestorage 2.3.2 "NativeStorage"
cordova-plugin-network-information 2.0.1 "Network Information"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-vibration 3.1.0 "Vibration"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-x-socialsharing 5.4.1 "SocialSharing"
es6-promise-plugin 4.2.2 "Promise"
pushwoosh-cordova-plugin 7.8.7 "Pushwoosh"

With the addition of

cordova-plugin-google-analytics 1.8.x "Google Universal Analytics Plugin"

1.8.3 works perfectly fine but 1.8.6 crashes. But only if installed from Google Play Store and even then only on initial run. (I'm not entirely sure about only crashing on initial run, it might crash on any)

Due to issue appearing only on Google Play Store installs getting more detailed error reports is somewhat difficult and we've been unable to reproduce the issue with local installs.

gabiriel commented 5 years ago

Thanks for your help concerning the working version 1.8.3, I faced the same issue yesterday when I pushed on the PlayStore (I haven't test on Apple Store) Here are my plugins:

cordova-admob-sdk 0.17.0 "AdMob SDK" cordova-plugin-admob-free 0.15.0 "Cordova AdMob Plugin" cordova-plugin-app-version 0.1.9 "AppVersion" cordova-plugin-device 2.0.2 "Device" cordova-plugin-file 6.0.1 "File" cordova-plugin-firebase 0.1.25 "Google Firebase Plugin" cordova-plugin-globalization 1.0.9 "Globalization" cordova-plugin-inappbrowser 2.0.2 "InAppBrowser" cordova-plugin-media 5.0.2 "Media" cordova-plugin-network-information 2.0.1 "Network Information" cordova-plugin-screen-orientation 3.0.1 "Screen Orientation" cordova-plugin-splashscreen 5.0.2 "Splashscreen" cordova-plugin-statusbar 2.4.2 "StatusBar" cordova-plugin-whitelist 1.3.3 "Whitelist" cordova-plugin-x-socialsharing 5.2.1 "SocialSharing" cordova-promise-polyfill 0.0.2 "cordova-promise-polyfill" es6-promise-plugin 4.2.2 "Promise"

with

cordova-plugin-google-analytics 1.8.3 "Google Universal Analytics Plugin"

alfredteo36 commented 5 years ago

i face the same issue too. Tracking is not working in google analytics for android

victorsosa commented 5 years ago

GMS_VERSION is a OS variable, it need to be added to the env

spinninghamster commented 5 years ago

I am facing the same issue. It doesn't crash, however. For me, the app compiles but doesn't log any views in Analytics.

alexlopezit commented 5 years ago

Same issue here, downgrading to 1.8.2 works for me

malwatte commented 5 years ago

I had this issue in 1.8.6 and I changed the gms version to 16.0.3 and it started to work.

cordova plugin add cordova-plugin-google-analytics --variable GMS_VERSION=16.0.3

Check other plugins and change the GMS_VERSION version accordingly

victorsosa commented 4 years ago

related to #551