当我尝试运行我的应用程序时出现以下错误,不确定原因是什么或如何解决?
[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
答案 0 :(得分:0)
我猜您在使用一个Google Play服务支持库nuget程序包后遇到了这个问题。如果是这种情况,请确保所有库版本相互匹配。 例如,如果要在xamarin android应用程序中显示广告,则需要以下两个Google库:Xamarin.GooglePlayServices.Ads和Xamarin.GooglePlayServices.Basement您应确保将它们中的每一个都安装在相同版本的项目中。如果您安装的版本是60.1142.1,则两者应为同一版本。
我希望这有助于解决您的问题或其他任何类似问题。
答案 1 :(得分:0)
我在OneSignal nuget软件包中也遇到此错误。这是发生了什么。 OneSignal库依赖于Xamarin.GooglePlayServices.Basement和其他支持库。因此,我直接升级了这些Google支持库,而没有升级OneSignal nuget。两者之间变得有些矛盾。由于OneSignal不支持最新的Google支持库,因此引发了此异常。因此,请检查其他具有Google支持库的nuget软件包的依赖性