Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebase error when building project #741

Closed
augustosnk12 opened this issue May 26, 2021 · 10 comments
Closed

Firebase error when building project #741

augustosnk12 opened this issue May 26, 2021 · 10 comments
Assignees

Comments

@augustosnk12
Copy link

Hi there,

I'm trying to run my react native application but I'm receaving the following errors and I don't have any idea how to solve it. I'm using the last version of react-native-notifications (3.4.2). Any answer or solution would be very appreciated.

F:\ProjetosGit\gmex\node_modules\react-native-notifications\lib\android\app\src\main\java\com\wix\reactnativenotifications\fcm\FcmToken.java:12: error: cannot find symbol import com.google.firebase.iid.FirebaseInstanceId; ^ symbol: class FirebaseInstanceId location: package com.google.firebase.iid F:\ProjetosGit\gmex\node_modules\react-native-notifications\lib\android\app\src\main\java\com\wix\reactnativenotifications\fcm\FcmToken.java:13: error: cannot find symbol import com.google.firebase.iid.InstanceIdResult; ^ symbol: class InstanceIdResult location: package com.google.firebase.iid F:\ProjetosGit\gmex\node_modules\react-native-notifications\lib\android\app\src\main\java\com\wix\reactnativenotifications\fcm\FcmToken.java:78: error: cannot find symbol FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListener(new OnSuccessListener<InstanceIdResult>() { ^ symbol: class InstanceIdResult location: class FcmToken F:\ProjetosGit\gmex\node_modules\react-native-notifications\lib\android\app\src\main\java\com\wix\reactnativenotifications\fcm\FcmToken.java:80: error: cannot find symbol public void onSuccess(InstanceIdResult instanceIdResult) { ^ symbol: class InstanceIdResult F:\ProjetosGit\gmex\node_modules\react-native-notifications\lib\android\app\src\main\java\com\wix\reactnativenotifications\fcm\FcmToken.java:78: error: cannot find symbol FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListener(new OnSuccessListener<InstanceIdResult>() { ^ symbol: variable FirebaseInstanceId location: class FcmToken Note: F:\ProjetosGit\gmex\node_modules\react-native-notifications\lib\android\app\src\main\java\com\wix\reactnativenotifications\core\notification\PushNotification.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details.

@sdiaz
Copy link

sdiaz commented May 28, 2021

I have the same problem

java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$4.done(AsyncTask.java:415)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/iid/FirebaseInstanceId;
at com.wix.reactnativenotifications.fcm.FcmToken.refreshToken(FcmToken.java:78)
at com.wix.reactnativenotifications.fcm.FcmToken.onAppReady(FcmToken.java:68)
at com.wix.reactnativenotifications.fcm.FcmInstanceIdRefreshHandlerService.onHandleWork (FcmInstanceIdRefreshHandlerService.java:26)
at androidx.core.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:392)
at androidx.core.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:383)
at android.os.AsyncTask$3.call(AsyncTask.java:394)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
at java.lang.Thread.run(Thread.java:923)

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

Using:

"@react-native-firebase/app": "12.0.0",
"@react-native-firebase/analytics": "12.0.0",
"@react-native-firebase/auth": "12.0.0",
"@react-native-firebase/crashlytics": "12.0.0",
"@react-native-firebase/firestore": "12.0.0",
"@react-native-firebase/messaging": "12.0.0",
"react-native-notifications": "3.4.2",

Android:

classpath 'com.google.gms:google-services:4.3.8'

@sdiaz
Copy link

sdiaz commented May 28, 2021

@augustosnk12

If you don't need the latest firebase core, I recommend to downgrade react-native-firebase to 11.5.0 to get it back to work until an update to the new firebase

@augustosnk12
Copy link
Author

What solved my problem was removing the firebaseVersion = "+" from the android/build.gradle file. I still don't know what exactly is the cause of the problem but it's working now.

@williamsilveira45
Copy link

Same problem here!

@Elprior
Copy link

Elprior commented May 29, 2021

@augustosnk12

If you don't need the latest firebase core, I recommend to downgrade react-native-firebase to 11.5.0 to get it back to work until an update to the new firebase

Same problem here.
Going back to 11.5.0 instead of 12.0.0 seems to fix the issue.
Thx!

@kesha-antonov
Copy link

kesha-antonov commented Jun 2, 2021

Same issue
Setting firebaseVersion = '21.1.0' didn't help

@scott0228
Copy link

Add the firebase-iid dependency:

dependencies {
    implementation "com.google.firebase:firebase-iid"
}

@DanielEliraz DanielEliraz self-assigned this Jun 23, 2021
yogevbd added a commit that referenced this issue Jun 23, 2021
In order to solve #741 it seems we need to stop using firebase iid that is [deprecated](https://firebase.google.com/docs/reference/android/com/google/firebase/iid/package-summary). As part of it, I bumped the firebase-messaging version to 21.1.0

Co-authored-by: Yogev Ben David <yogev132@gmail.com>
@DanielEliraz
Copy link
Collaborator

Will be released soon

@code-by
Copy link

code-by commented Mar 17, 2022

after installing @react-native-firebase/app 14.5.1 have build error
comment line
implementation 'com.google.firebase:firebase-analytics:17.3.0'
resolve build problem, than uncomment and add
implementation "com.google.firebase:firebase-iid"
build passed successfully

@camboYY
Copy link

camboYY commented Jun 17, 2022

Same problem here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants