Cress
Cress

Reputation: 432

How to properly update Google Analytics Unity plugin

I have a game for Android with GAv3 installed, if I update Google Analytics to version 4 the game starts but I get some exceptions. Here's a log from Android Device Monitor:

03-15 16:06:44.906: I/Unity(17009): AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.gms.analytics.GoogleAnalytics
03-15 16:06:44.906: I/Unity(17009): java.lang.ClassNotFoundException: com.google.android.gms.analytics.GoogleAnalytics
03-15 16:06:44.906: I/Unity(17009):     at java.lang.Class.classForName(Native Method)
03-15 16:06:44.906: I/Unity(17009):     at java.lang.Class.forName(Class.java:251)
03-15 16:06:44.906: I/Unity(17009):     at java.lang.Class.forName(Class.java:216)
03-15 16:06:44.906: I/Unity(17009): Caused by: java.lang.NoClassDefFoundError: com/google/android/gms/analytics/GoogleAnalytics
03-15 16:06:44.906: I/Unity(17009): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.analytics.GoogleAnalytics" on path: DexPathList[[zip file "/mnt/asec/com.app.game-1/pkg.apk"],nativeLibraryDirectories=[/mnt/asec/com.app.game-1/lib, /vendor/lib, /system/lib]]
03-15 16:06:45.286: I/Unity(17009): AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.gms.analytics.GoogleAnalytics
03-15 16:06:45.286: I/Unity(17009): java.lang.ClassNotFoundException: com.google.android.gms.analytics.GoogleAnalytics
03-15 16:06:45.286: I/Unity(17009):     at java.lang.Class.classForName(Native Method)
03-15 16:06:45.286: I/Unity(17009):     at java.lang.Class.forName(Class.java:251)
03-15 16:06:45.286: I/Unity(17009):     at java.lang.Class.forName(Class.java:216)
03-15 16:06:45.286: I/Unity(17009): Caused by: java.lang.NoClassDefFoundError: com/google/android/gms/analytics/GoogleAnalytics
03-15 16:06:45.286: I/Unity(17009): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.analytics.GoogleAnalytics" on path: DexPathList[[zip file "/mnt/asec/com.app.game-1/pkg.apk"],nativeLibraryDirectories=[/mnt/asec/com.app.game-1/lib, /vendor/lib, /system/lib]]

I tried installing the plugin directly, thus letting Unity overwrite the files, and deleting the files by myself and installing afterwards. In both cases I get these errors.

Upvotes: 1

Views: 2026

Answers (1)

Programmer
Programmer

Reputation: 125305

Copy play-services-analytics-8.4.0.aar from {android-sdk}\extras\google\m2repository\com\google\android\gms\play-services-analytics\8.4.0 to your Assets/Plugins/Android folder. It worked for this person and may work for you.

Upvotes: 4

Related Questions