3

Am getting the following error when I try to run my application, not sure what is the cause or how to resolve ?

[AndroidRuntime] java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/R$string;
[AndroidRuntime]    at com.google.android.gms.measurement.zza.<init>(Unknown Source)
[AndroidRuntime]    at com.google.android.gms.measurement.zza.zzaR(Unknown Source)
[AndroidRuntime]    at com.google.android.gms.measurement.internal.zzn.zziJ(Unknown Source)
[AndroidRuntime]    at com.google.android.gms.measurement.internal.zzz.zza(Unknown Source)
[AndroidRuntime]    at com.google.android.gms.measurement.internal.zzw.<init>(Unknown Source)
[AndroidRuntime]    at com.google.android.gms.measurement.internal.zzaa.zzDj(Unknown Source)
[AndroidRuntime]    at com.google.android.gms.measurement.internal.zzw.zzaT(Unknown Source)
[AndroidRuntime]    at com.google.android.gms.measurement.AppMeasurementContentProvider.onCreate(Unknown Source)
[AndroidRuntime]    at android.content.ContentProvider.attachInfo(ContentProvider.java:1758)
[AndroidRuntime]    at android.content.ContentProvider.attachInfo(ContentProvider.java:1733)
[AndroidRuntime]    at android.app.ActivityThread.installProvider(ActivityThread.java:6326)
[AndroidRuntime]    at android.app.ActivityThread.installContentProviders(ActivityThread.java:5918)
[AndroidRuntime]    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5857)
[AndroidRuntime]    at android.app.ActivityThread.-wrap3(ActivityThread.java)
[AndroidRuntime]    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1699)
[AndroidRuntime]    at android.os.Handler.dispatchMessage(Handler.java:102)
[AndroidRuntime]    at android.os.Looper.loop(Looper.java:154)
[AndroidRuntime]    at android.app.ActivityThread.main(ActivityThread.java:6682)
[AndroidRuntime]    at java.lang.reflect.Method.invoke(Native Method)
[AndroidRuntime]    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
[AndroidRuntime]    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
[AndroidRuntime] Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.R$string" on path: DexPathList[[zip file "/data/app/na.com.app-1/base.apk"],nativeLibraryDirectories=[/data/app/na.com.app-1/lib/arm, /system/fake-libs, /data/app/na.com.app-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
[AndroidRuntime]    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
[AndroidRuntime]    at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
[AndroidRuntime]    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
[AndroidRuntime]    ... 21 more
Lennie
  • 2,429
  • 2
  • 18
  • 16

2 Answers2

3

I guess you have this issue after using one Google play services support library nuget packages. If that is the case, make sure all of the libraries versions match with each other. For example, if you want to display ads in your xamarin android application, you need these two Google libraries : Xamarin.GooglePlayServices.Ads and Xamarin.GooglePlayServices.Basement You should make sure each of them are installed in your project with the same version. if you install version 60.1142.1, then both should be of the same version.

I hope this helps resolve your issue or any other similar issues.

Damien Doumer
  • 1,991
  • 1
  • 18
  • 33
0

I had this error also with OneSignal nuget package. Here is what it happens. OneSignal library has a dependency on Xamarin.GooglePlayServices.Basement and Other support libraries. So I upgraded those google support libraries directly without upgrading OneSignal nuget. there it becomes some inconsistency between them. Because OneSignal wasn't supporting latest google support libraries and this exception was thrown. So check the dependency of other nuget packages which are having google support libraries

Emil
  • 6,411
  • 7
  • 62
  • 112