googleanalytics / google-analytics-plugin-for-unity

Google Analytics plugin for the Unity game creation system
Apache License 2.0
385 stars 140 forks source link

GA4 Unity problem AndroidJavaException? #174

Closed e140 closed 6 years ago

e140 commented 6 years ago

Hi. I have a unity project. After the adMob update (dll update to Google.JarResolver_v1.2.64.0), and update Unity, GA4 plugin stopped working on android. (no error in the editor). Checked for Unity 2017.31 Unity 2017.41 and Unity 2018.1.2 - without changes.

In first scene INAP and GP_Login initialization. Error on the GA4 plugin. I create a separate scene to make sure.

adb logcat:

E/Unity (22986): AndroidJavaException: java.lang.NoClassDefFoundError: com.google.android.gms.common.internal.Preconditions E/Unity (22986): java.lang.NoClassDefFoundError: com.google.android.gms.common.internal.Preconditions E/Unity (22986): at com.google.android.gms.internal.measurement.zzat.zzc(Unknown Source) E/Unity (22986): at com.google.android.gms.analytics.GoogleAnalytics.getInstance(Unknown Source) E/Unity (22986): at com.unity3d.player.UnityPlayer.nativeRender(Native Method) E/Unity (22986): at com.unity3d.player.UnityPlayer.c(Unknown Source) E/Unity (22986): at com.unity3d.player.UnityPlayer$e$2.queueIdle(Unknown Source) E/Unity (22986): at android.os.MessageQueue.next(MessageQueue.java:192) E/Unity (22986): at android.os.Looper.loop(Looper.java:124) E/Unity (22986): at com.unity3d.player.UnityPlayer$e.run(Unknown Source) E/Unity (22986): at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in :0 E/Unity (22986): at UnityEngine.AndroidJNISafe.CallStaticObjectMethod (IntPtr clazz, IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in :0 E/Unity (22986): at UnityEngine.AndroidJavaObject._CallStatic[AndroidJavaObject] (System.String methodName, System.Objec

What's the problem?

c-andrews commented 6 years ago

Hi, I am getting the same issue, have you been able to resolve it?

e140 commented 6 years ago

Hi. No. I had to abandon GA and go to Firebase to fix this bug. I'm not very happy about this. GA was significantly better, but it looks like Google buried this project for mobile.

kkohno commented 6 years ago

I have the same issue on empty project! Unity version 2018.2.2f1

hmcGit commented 6 years ago

Hi.I solved this problem! PlayServiceResolver in GoogleAnalytics v4 unitypackage is old. I Delete old PlayService Resolver from GoogleAnalyticsv4 package and Re Import new version of PlayService Resolver in GoogleAds-mobile package.

1.Delete Assets/PlayServiceResolver/Editor/* 2.Download Google mobile ads plugin https://github.com/googleads/googleads-mobile-unity/releases

  1. Import from Google mobile ads plugin and use only PlayServiceResolver new version.
  2. Finish Importing new version of Play Service Resolver , Delete old jar or aar in Plugins/Android/ Folder ( like play-services-analytics-.jar/support--*.aar/ and so on) 5.PlayService Resolver->Android->Force Resolve using new PlayService Resolver,in Plugins/Android Folder , imported these files. like com.google.android.gms.play-services-analytics-16.0.1 android.arch.core.common-1.0.0/and so on.

6.Build apk, my app has no errors !