NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/util/zzw
See original GitHub issueHi,
I updated my dependencies in my app/build.gradle. Now I get the following red-screen error when I start my app (everything else is building correctly):
Java exception in 'NativeModules'
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/util/zzw;
com.learnium.RNDeviceInfo.RNDeviceModule.getConstants
RNDeviceModule.java:260
com.facebook.react.bridge.JavaModuleWrapper.getConstants
JavaModuleWrapper.java:140
android.os.Handler.handleCallback
Handler.java:751
android.os.Handler.dispatchMessage
Handler.java:95
com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage
MessageQueueThreadHandler.java:31
<unknown>
deviceinfo.js:6:33
loadModuleImplementation
require.js:213:12
guardedLoadModule
require.js:147:36
_require
require.js:131:20
<unknown>
HotelsScreen.js:19
loadModuleImplementation
require.js:213:12
guardedLoadModule
require.js:147:36
_require
require.js:131:20
<unknown>
StartScreen.js:5
loadModuleImplementation
require.js:213:12
guardedLoadModule
require.js:147:36
_require
require.js:131:20
<unknown>
AppNavigator.js:13
loadModuleImplementation
require.js:213:12
guardedLoadModule
require.js:147:36
_require
require.js:131:20
<unknown>
Root.js:4
loadModuleImplementation
require.js:213:12
guardedLoadModule
require.js:147:36
_require
require.js:131:20
<unknown>
index.android.js:3
loadModuleImplementation
require.js:213:12
guardedLoadModule
require.js:140:45
_require
require.js:131:20
global code
This only happens on android. I tried to add
compile ("com.google.android.gms:play-services-gcm:16.1.0") {
force = true;
}
in my dependencies, but with no luck.
my android settings:
compileSdkVersion 27 buildToolsVersion “27.0.1” … minSdkVersion 16 targetSdkVersion 27 Device: Samsung Galaxy S6
also, I tried to do the following suggestions: https://stackoverflow.com/questions/51036749/react-native-device-info-crash-the-app-on-android but that didn’t work either.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:8
Top Results From Across the Web
Failed resolution of: Landroid/support/v4/os/BuildCompat ...
You are getting NoClassDefFoundError & ClassNotFoundException. NoClassDefFoundError in Java comes when Java Virtual Machine is not able to find a particular ...
Read more >java.lang.NoClassDefFoundError: Failed resolution of: Lcs ...
i compiled my extension but java.lang.NoClassDefFoundError: Failed resolution of: Lcs/min2phase/Search; is the error i got in app ...
Read more >java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin ...
java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/KotlinPackage. Try to run a Kotlin project on Android studio (3.6.+) then get this error and ...
Read more >java.lang.NoClassDefFoundError: Failed resolution of - Medium
NoClassDefFoundError : Failed resolution of: Lcom/package/id/MyLayoutBinding. Sometime back we upgraded our android project gradle wrapper ...
Read more >java.lang.NoClassDefFoundError: Failed resolution of: Lcom ...
When using compile 'net.rdrei.android.dirchooser:library:3.2@aar', I get the following error: 04-09 22:50:20.638 11862 11862 E ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I also got the same problem recently. After hours of trials and errors (and hair pulling), turned out it’s simply because of version mismatch between
'play-services-gcm'
and'firebase-messaging'
.I have
"com.google.android.gms:play-services-gcm:10.2.6"
set on app/build.gradle dependencies. But I never set or include'firebase-messaging'
, it’s probably included implicitly by one of library.To force versions used by library, you can set it on app/build.gradle:
or
either one will give the same result, I prefer the first one because it’s easy on eyes.
That’s it, it fixes the dreaded red screen NoClassDefFoundError for me.
You might want to verify versions used by library dependencies.
To see actual versions used by dependencies, check your
'\android\app\build\intermediates\exploded-aar\'
folder.For example in my pc I have:
\exploded-aar\com.google.android.gms\play-services-gcm\10.2.6\
and\exploded-aar\com.google.firebase\firebase-messaging\10.2.6\
folder, which is good because both versions are the same.Make sure libraries inside
\com.google.android.gms\
and\com.google.firebase\
all use the same version.If all above still fails, as last resort you can try disable InstanceID check on
RNDeviceModule.java
.https://github.com/rebeccahughes/react-native-device-info/blob/02d63b9aabf7f553abe77bb72bc024f35ef1db68/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java#L270-L276
You can find it on your local
\node_modules\react-native-device-info\android\src\main\java\com\learnium\RNDeviceInfo\RNDeviceModule.java
That
InstanceID.getInstance().getId()
line is where you get the red screen runtime error of NoClassDefFoundError.I try commenting it out at first, and it works preventing NoClassDefFoundError. But it’s a quick hack, it doesn’t solve the main problem. Only use it if you’re in a hurry. 😉
Hope this helps.
Hey I had the same problem, I’ve resolved it by adding
googlePlayServicesVersion=X.X.X
in thegradle.properties
file in the android folder. Tell me if it works for you ^^