Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/iid/FirebaseInstanceId; React Native App

I've been trying to run my react native application, but it crashed when started and the debugger didn't return any error, so I checked the log cat in Android Studio and it shows me the following error: java.lang.NoClassDefFoundError: Failed resolution of: Lcom / google / firebase / iid / FirebaseInstanceId;

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.iid.FirebaseInstanceId"

The React-Native version that I am using is: 0.61.5 And the version of react-native-firebase that I have installed is 5.6.0

It has already been a recent failure, since previously the app worked correctly and I have not made any changes to the firebase integration either

like image 704
jhosep islam Avatar asked Mar 01 '23 14:03

jhosep islam


2 Answers

To debug this, first I would suggest running adb logcat and seeing what Java error you are getting. If it errors out on the not being able to find the required Java classes, then try adding the following to your project:

app/build.gradle file (dependencies section):

implementation 'com.google.firebase:firebase-iid'

(You might need to provide a version for this package as well)

like image 116
vladikoff Avatar answered Mar 07 '23 20:03

vladikoff


I have getting same error, I fixed this error by uninstalling old version and installing new version of push notification.

uninstall:
npm uninstall react-native-push-notification
install:
npm i react-native-push-notification

since react-native-push-notification upgraded to new version v7.x so that, while installing app it give above error.

checkout this -> https://www.npmjs.com/package/react-native-push-notification

like image 27
Vishal Pawar Avatar answered Mar 07 '23 18:03

Vishal Pawar