Googleplayservicescomponents: Getting Failed resolution of: Lcom/google/android/gms/R$string;

Created on 19 Aug 2017  路  40Comments  路  Source: xamarin/GooglePlayServicesComponents

Xamarin.Android Version (eg: 6.0):

7.4.0.19

Operating System & Version (eg: Mac OSX 10.11):

windows 10 pro

Google Play Services Version (eg: 8.4.0):

Describe your Issue:

I'm using version 32.961.0 to be compatible with TagManager v4.

Getting this error at start of the application.

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/R$string;

Steps to Reproduce (with link to sample solution if possible):

Add TagManager 32.961.0 to android project

Include any relevant Exception Stack traces, build logs, adb logs:

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/R$string;
08-19 18:09:17.063 E/AndroidRuntime( 3615): at com.google.android.gms.common.internal.zzaj.(Unknown Source)
08-19 18:09:17.063 E/AndroidRuntime( 3615): at com.google.firebase.FirebaseOptions.fromResource(Unknown Source)
08-19 18:09:17.063 E/AndroidRuntime( 3615): at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
08-19 18:09:17.063 E/AndroidRuntime( 3615): at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
08-19 18:09:17.063 E/AndroidRuntime( 3615): at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
08-19 18:09:17.063 E/AndroidRuntime( 3615): at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
08-19 18:09:17.063 E/AndroidRuntime( 3615): at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
08-19 18:09:17.063 E/AndroidRuntime( 3615): at android.app.ActivityThread.installProvider(ActivityThread.java:5153)
08-19 18:09:17.063 E/AndroidRuntime( 3615): at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
08-19 18:09:17.063 E/AndroidRuntime( 3615): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
08-19 18:09:17.063 E/AndroidRuntime( 3615): at android.app.ActivityThread.-wrap1(ActivityThread.java)
08-19 18:09:17.063 E/AndroidRuntime( 3615): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
08-19 18:09:17.063 E/AndroidRuntime( 3615): at android.os.Handler.dispatchMessage(Handler.java:102)
08-19 18:09:17.063 E/AndroidRuntime( 3615): at android.os.Looper.loop(Looper.java:148)
08-19 18:09:17.063 E/AndroidRuntime( 3615): at android.app.ActivityThread.main(ActivityThread.java:5417)
08-19 18:09:17.063 E/AndroidRuntime( 3615): at java.lang.reflect.Method.invoke(Native Method)
08-19 18:09:17.063 E/AndroidRuntime( 3615): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
08-19 18:09:17.063 E/AndroidRuntime( 3615): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
08-19 18:09:17.063 E/AndroidRuntime( 3615): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.R$string" on path: DexPathList[[zip file "/data/app/ch.globus.customer-1/base.apk"],nativeLibraryDirectories=[/data/app/ch.globus.customer-1/lib/x86, /data/app/ch.globus.customer-1/base.apk!/lib/x86, /vendor/lib, /system/lib]]
08-19 18:09:17.063 E/AndroidRuntime( 3615): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
08-19 18:09:17.063 E/AndroidRuntime( 3615): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
08-19 18:09:17.063 E/AndroidRuntime( 3615): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)

Most helpful comment

Can this be reopened? The solution "A couple of rebuild all solutions fixed the issue" doesn't seem satisfactory. This keeps happening to our projects and although a rebuild fixes it most of the time, we're losing a lot of time by having to completely rebuild.

All 40 comments

Argh, Xamarin is having fun with me. A couple of rebuild all solutions fixed the issue.

Can this be reopened? The solution "A couple of rebuild all solutions fixed the issue" doesn't seem satisfactory. This keeps happening to our projects and although a rebuild fixes it most of the time, we're losing a lot of time by having to completely rebuild.

We also just ran into this issue. I also would like to see this fixed as now our continuous build system will sometimes result in working builds and sometimes result in builds with issues.

Ran into the same problem, rebuilding fixed the issue but this is a massive waste of time.

I have no idea if this is related, but my app is constantly crashing after I added the NuGet package Xamarin.Frirebase.Crash, and rebuilding several times doesn't seem to work.

This is what I've got in the app output:

[AndroidRuntime] java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/R$string;
[AndroidRuntime]    at com.google.android.gms.common.internal.zzbz.<init>(Unknown Source)
[AndroidRuntime]    at com.google.firebase.FirebaseOptions.fromResource(Unknown Source)
[AndroidRuntime]    at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
[AndroidRuntime]    at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
[AndroidRuntime]    at android.content.ContentProvider.attachInfo(ContentProvider.java:1739)
[AndroidRuntime]    at android.content.ContentProvider.attachInfo(ContentProvider.java:1708)
[AndroidRuntime]    at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
[AndroidRuntime]    at android.app.ActivityThread.installProvider(ActivityThread.java:5262)
[AndroidRuntime]    at android.app.ActivityThread.installContentProviders(ActivityThread.java:4836)
[AndroidRuntime]    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4776)
[AndroidRuntime]    at android.app.ActivityThread.access$1500(ActivityThread.java:170)
[AndroidRuntime]    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1502)
[AndroidRuntime]    at android.os.Handler.dispatchMessage(Handler.java:111)
[AndroidRuntime]    at android.os.Looper.loop(Looper.java:194)
[AndroidRuntime]    at android.app.ActivityThread.main(ActivityThread.java:5576)
[AndroidRuntime]    at java.lang.reflect.Method.invoke(Native Method)
[AndroidRuntime]    at java.lang.reflect.Method.invoke(Method.java:372)
[AndroidRuntime]    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:955)
[AndroidRuntime]    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:750)
[AndroidRuntime] Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.R$string" on path: DexPathList[[zip file "/data/app/com.mydomain.myapp-1/base.apk"],nativeLibraryDirectories=[/data/app/com.mydomain.myapp-1/lib/arm, /vendor/lib, /system/lib]]
[AndroidRuntime]    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
[AndroidRuntime]    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
[AndroidRuntime]    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
[AndroidRuntime]    ... 19 more
[AndroidRuntime]    Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.R$string
[AndroidRuntime]        at java.lang.Class.classForName(Native Method)
[AndroidRuntime]        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
[AndroidRuntime]        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
[AndroidRuntime]        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
[AndroidRuntime]        ... 20 more
[AndroidRuntime]    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
[Process] Sending signal. PID: 18692 SIG: 9

Same issue here intermittently, very annoying.

This seriously needs to be reopened, it's annoying as heck.

Clean, then rebuild... always the same. I love Xamarin, but solving problems this way is driving me crazy.

We also have this issue pretty frequently.
With a project that requires about 2min for a full rebuild, the "clean and rebuild" solution, cannot be a solution

Any updates on this issue?

References in visual studio mac seem to be f'ed up. In 'Reference from Packages' dependencies sometimes get referenced multiple times. Not sure what that exactly means, but I do know that it breaks builds. Also no clue what it causes either or how to fix it apart from regularly checking if it looks 'ok'.

I detected it was a problem between the splash screen resolution and the emulator resolution... don't know how to solve it. I just supposed it was an emulator error, and tried with another one... It's not a solution, but it is a workaround. Don't get stucked!

Running into this with release builds only, debug builds are working fine. Very sad that this issue was closed when it hasn't been fixed.

Same with Firebase.Analytics... opened an other issue! #117

Finally I can get red of this issue,

I had to go to android options -> android builds -> advanced.
and remove armeabi-v7a then build and run (it will fail). then go back and reselect armeabi-v7.
clean, build and run,

this solved my case, and I hope it will help you all.

actually cleaning is the only way to solve this atm @ahmadalgarni

this error pops up when i switch branches, or edit some resource files in a different IDE (e.g. android studio for layouts)

i even wrote a clean script since visual studio mac is apparently not able to remove generated files...

https://gist.github.com/kibotu/5d8f9c75fc828d1564f290b3dbccf78b

which sucks is the frequency of this happening and the unnecessary full rebuilds it implies

another thing which really grinds my gear is that all xamarin errors are solved by cleaning and rebuilding and that's the only feedback from the community you apparently get to most xamarin problems, since i'm not a big fan of fixing symptoms!

This error came back again to me , and I tried the solution I proposed and Didn't work this time,

Xamarin sometimes gets weird

The solution that works for me is to build my app through the terminal after I have updated the layouts using:

msbuild /t:SignAndroidPackage

If I then build again in Xamarin it deploys with no problems.
This is ofcourse not a good fix, only a temp solution. I'm really hoping they resolve this quickly.

this happens to me when I am in Debugging mode, But the app works fine in release mode

not always ... :/ make sure to test if your app runs before you publish

I get this more often than a successful build.

This is an issue for me as well. Not sure why this is closed since so many developers are experiencing this issue.

Can we re-open this build? All of the developers that I work with get this all the time.

Does anyone able to generate release build without crash ? Debug is working fine, only happen in release build.

Generally what works for me is a clean, rebuild project, then archive for publishing.

Hello,

I have both Build and Device Deployment diagnostic logs that might help debug this issue.

They contain sensitive data so I'd rather not upload them in the wild.

Thanks,
Cosmin

Same issue, cleaning then rebuild seems to be solving the problem for now, but how do I make sure the archive that I produce before publishing is intact?

The app sample works good with the workaround, though I'm still having issue when I try to add firebase to my own app.

In our case non-english character in the filename and classname caused this error.
Fixing the filename and classname with all class references fixed this error permanently for us.

I am getting a similar issue on:
Visual Studio Community 2017 for Mac
Version 7.4 (build 1033)

here is the exception log in application output:

[AndroidRuntime] java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/R$string;
[AndroidRuntime] at com.google.android.gms.common.internal.zzbz.(Unknown Source:14)
[AndroidRuntime] at com.google.firebase.FirebaseOptions.fromResource(Unknown Source:2)
[AndroidRuntime] at com.google.firebase.FirebaseApp.initializeApp(Unknown Source:19)
[AndroidRuntime] at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source:4)
[AndroidRuntime] at android.content.ContentProvider.attachInfo(ContentProvider.java:1927)
[AndroidRuntime] at android.content.ContentProvider.attachInfo(ContentProvider.java:1902)
[AndroidRuntime] at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source:23)
[AndroidRuntime] at android.app.ActivityThread.installProvider(ActivityThread.java:6578)
[AndroidRuntime] at android.app.ActivityThread.installContentProviders(ActivityThread.java:6133)
[AndroidRuntime] at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6043)
[AndroidRuntime] at android.app.ActivityThread.-wrap1(Unknown Source:0)
[AndroidRuntime] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
[AndroidRuntime] at android.os.Handler.dispatchMessage(Handler.java:105)
[AndroidRuntime] at android.os.Looper.loop(Looper.java:164)
[AndroidRuntime] at android.app.ActivityThread.main(ActivityThread.java:6944)
[AndroidRuntime] at java.lang.reflect.Method.invoke(Native Method)
[AndroidRuntime] at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
[AndroidRuntime] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
[AndroidRuntime] Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.R$string" on path: DexPathList[[zip file "/appPath-vViz9j1kB6Z4pwWARpKUNA==/base.apk"],nativeLibraryDirectories=[/appPath-vViz9j1kB6Z4pwWARpKUNA==/lib/arm, /appPath-vViz9j1kB6Z4pwWARpKUNA==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]]
[AndroidRuntime] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
[AndroidRuntime] at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
[AndroidRuntime] at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
[AndroidRuntime] ... 18 more

The issue disappeared after full clean and build.

+1 - I've just experienced this too - clean and build and it worked 馃檲Makes me nervous though!

Same here. It's a very annoying process to go through when it happens, as it seems sometimes one needs multiple rebuilds to make it go away.

reported 19 Aug 2017 :/ no work in progress in sight

it worked after clean and rebuild project

Rebuilt many times

Does no one know what causes this issue and why clean and rebuild fixes it?

Solved by update all gradle dependency included root gradle

The issue occurs with

classpath 'com.android.tools.build:gradle:3.6.0'
classpath 'com.google.gms:google-services:4.3.3'
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/R$string;
        at com.google.android.gms.common.internal.StringResourceValueReader.<init>(Unknown Source:4)
        at com.google.firebase.FirebaseOptions.fromResource(com.google.firebase:firebase-common@@19.3.0:156)
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.3.0:244)
        at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common@@19.3.0:51)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1927)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1902)
        at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:firebase-common@@19.3.0:45)
        at android.app.ActivityThread.installProvider(ActivityThread.java:6578)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:6133)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6043)
        at android.app.ActivityThread.-wrap1(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
        at android.os.Handler.dispatchMessage(Handler.java:105)
        at android.os.Looper.loop(Looper.java:164)

Close VS, clean & build. Without closing, it is not solved for me.

Was this page helpful?
0 / 5 - 0 ratings