In my Unity project, I used some assets like FacebookSDK, OneSignal etc. Whenever I import OneSignal, this error will be shown.
Google.JarResolver.Re
From the following two unique lines in your log:
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzcn;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/BuildConfig;
This means there are 2 or more copies of the Google Play services library
and the Android Support Library v4
in your project.
In order to use the OneSignal and Facebook SDKs together in the same Unity project you will need to delete the following duplicated libraries noted in the OneSignal troubleshooting guide.
FacebookSDK/plugins/android/libs/support-v4-23.4.0.aar
FacebookSDK/plugins/android/libs/support-annotations-23.4.0.aar
This will fix the already added: Landroid/support/v4
errors unless their is a 3rd plugin with this library as well in your project.
I recommend deleting duplicate play-services-[library]-[version].aar
files in your Unity project. There will be different [libraries]
however there should only be a single version for all play-services-*.aar
files. This should fix the already added: Lcom/google/android/gms
errors.
If you get stuck update your question with a full list of plugins with version numbers. Also list all .aar
and .jar
files in your project. Additional you can create a new project and add one plugin at a time until you get the error to pin point the plugin combination creating the issue.
This question mentions a few different errors. All are eventually related to issues with native Android libraries (.jar or .aar) within the Unity project.
I'll try to address all of the issues you mentioned:
Cannot resolve (library name)
Google.JarResolver.ResolutionException: Cannot resolve com.google.firebase:firebase-analytics-unity:1.0.0()
A lot of Android plugins use the Play Services Resolver - this is helper code that attempts to simplify things by automatically resolving the needed Google play services libraries (located under the Android SDK folder).
It works by setting the needed dependencies to a static instance of a class, which then attempts to resolve the needed libraries. Sometimes, the operation of the resolver can fail, since it may become "out of sync" with its persisted data.
In this case, what probably happened is that the static object was still attempting to resolve the "firebase-analytics-unity" library, but this folder was removed from the project, so it failed to look it up.
Already Added Lxxx/xxx/xxx
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzah; Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzcn; Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/BuildConfig; Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat; Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoIcsImpl; Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoJellyBeanMr2; Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoStubImpl; Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl; Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/animation/AnimatorCompatHelper;
As was already answered by @jkasten, your project contains multiple plugins that contain the same compiled Java classes. The hint as to which library is duplicated can be found by the class names (not always helpful though). In this case, you can see that it's related to com.google.android.gms (google play services) and Android support library (android.support.v4.xxx).
No static method zzb
FATAL EXCEPTION: main E/AndroidRuntime(18680): java.lang.NoSuchMethodError: No static method zzb(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzaa; or its super classes (declaration of 'com.google.android.gms.common.internal.zzaa' appears in /data/app/***/base.apk) E/AndroidRuntime(18680): at com.google.firebase.provider.FirebaseInitProvider.zza(Unknown Source) E/AndroidRuntime(18680): at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) E/AndroidRuntime(18680): at android.app.ActivityThread.installProvider(ActivityThread.java:5159) E/AndroidRuntime(18680): at android.app.ActivityThread.installContentProviders(ActivityThread.java:4754) E/AndroidRuntime(18680): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4694) E/AndroidRuntime(18680): at android.app.ActivityThread.access$1600(ActivityThread.java:150) E/AndroidRuntime(18680): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405) E/AndroidRuntime(18680): at android.os.Handler.dispatchMessage(Handler.java:102) E/AndroidRuntime(18680): at android.os.Looper.loop(Looper.java:148) E/AndroidRuntime(18680): at android.app.ActivityThread.main(ActivityThread.java:5423) E/AndroidRuntime(18680): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(18680): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
This is a more subtle and tricky one. The game was built into an .apk, but crashes at runtime due to a class that is not found. Judging by the method name (zzb) - this is an internal "obfuscated" method inside Google play services. This can happen if you mix multiple versions of google play services together (for example - Firebase at version 9.8.0 with Google play services at a different version).
It's vital to keep all these versions consistent with one another, a task that could sometimes get a bit tricky with the Resolver that does this automatically.
Final Note:
I offer a professional service to assist fixing such issues. Please feel free to contact me in case you run into a similar issue in the future.