How to properly update Google Analytics Unity plugin

北城以北 提交于 2019-12-08 05:44:35

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/36041787/how-to-properly-update-google-analytics-unity-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!