Closed DavidHasan27 closed 5 years ago
post the full error please - need to know failed why
@mikehardy i have updated my issue with complete error. Let me know if you need any more details
Same issue.
same issue
this is the error i've got :
error: package android.support.annotation does not exist
This looks like incorrect / partial migration to AndroidX. There's an infinite number of ways to do it wrong, the jetifier project page has the instructions on how to do it correctly plus troubleshooting for the main reasons it goes wrong. It's not really a react-native-firebase problem - it's a problem with specific projects not using AndroidX and/or managing their dependencies correctly
I am also experienced this issue (package android.support.annotation does not exist
and other similar Java errors) with RN 0.60 and RNF 5.5.5 using Windows 10 + Visual Studio Code. My scenario - cfg files and errors - is almost identical to what has been shown by the OP, with the peculiar difference that I've only added the :react-native-firebase
project to a vanilla react-native app made with react-native init
.
From what I'm seeing - correct me if I'm wrong - there's not much to "migrate to AndroidX" anymore, since the init
command (with RN 0.60) is already pulling out an AndroidX-ready app boilerplate (with android.useAndroidX
and android.enableJetifier
set to true
), which perfectly builds and works.
The problems - in shape of Java conflicts - start as soon as you add RNF 5.5.5 and its references in the build.gradle
and settings.gradle
files, which I slightly modified to add the :react-native-firebase
project, strictly following the official guidelines: nothing fancy, the changes to the original code are minimal, yet those few references are still enough to prevent the app from running.
As for the errors, they definitely seem to occur because the various .java
files included within the /react-native-firebase/android/src/main/java/io/invertase/firebase/
folder - as shown in the OP error log - are full of Api28 references, which are not getting "Jetified" for some reasons.
I can provide additional info if you want: I can even push everyhing on GitHub, since my code is nothing more than a react-native init
vanilla code with the :react-native-firebase
project configured.
NOTE: switching to android.useAndroidX=false
fixes all the compilation issues with the RNF 5.5.5 java files, but it breaks other .java
files (RN 0.60 and other modules) that require androidx
dependencies.
@Darkseal please confirm that after doing the androidx migration (useJetifier=true etc) in AndroidStudio you have also installed the jetifier npm package and run npx jetifier
. If you have not done that, your build will fail
@mikehardy yes i have npx jetify
in my postinstall
and it fires properly.
Today I tried to fix by upgrading from 0.60.0 to 0.60.3, following the upgrade helper: the error is still the same but the offending .java
class changed:
MainActivity.java:5: error: cannot access ViewGroup
public class MainActivity extends ReactActivity {
^
class file for android.view.ViewGroup not found
1 error
Any advice?
@mikehardy good news, I managed to fix that by re-creating (again) a RN 0.60.3 project from scratch and then adding RNF 5.5.5. I've yet to see what was missing, but now the app builds and run just fine.
Between us, I feel kinda boring the fact that it's nearly impossible to understand what's going on behind the hood: we're basically forced to deal with these "un-debuggable" things by reinstalling from scratch... But hey, at least it works, therefore I can't complain too much I guess :)
If anyone is interested I can publish a GitHub boilerplate with everything set up and (hopefully) working.
@Darkseal yeah - my own efforts with my real project (as opposed to constructed on-the-fly demos) has been similar - each attempt is pretty much a mess and I'm about to just do a clean 0.60.3 + v5.5.5 + jetify myself :man_shrugging: - in the end it will likely be much much cleaner anyway as my .xcodeproj has slowly become worse over time
Hello guys, thanks a lot for this discussion! So what do you suggest solution to this issue in RN 0.59.10 (RNF 5.3.1) ? Cheers
I wouldn't combine those two, react-native-community/cli will begin calling jetifier directly shortly https://github.com/react-native-community/cli/pull/526
Additionally - @fcostaprojects - if you haven't been tracking jetifier changes in your package check the most recent issue - the first legitimate translation bug came in yesterday and if you're not tracking your library might be susceptible. Also there was a monorepo issue - as it's used more some interesting edge cases pop up
@mikehardy, I've removed "react-native-jetifier". App working perfectly.
Same issue, it's very difficult to create a brand new project and then add Firebase again due to the complexity and size of my project, would be greatly appreciated if this issue can be fixed quickly.
This issue destroyed my project and deadline. I mistakenly upgraded for the sake of iOS and it destroyed my android build ..
@jerryheir sorry you're having difficulties - you can see all the steps required for either RN59 or RN60 in this repo though, maybe it'll help you get straightened out: https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh or https://github.com/mikehardy/rnfbdemo/blob/master/make-demo-rn59.sh
Hi @mikehardy, I used your demo code and added firebase-messaging module to test it. Everything is fine until I send a message with firebase console ... the app is crashing ! I can see the following in adb logcat :
08-01 00:13:26.880 2576 16586 W ErrorProcessor: Caused by: com.google.android.apps.gsa.shared.exception.GsaIOException: Error code: 393238 | Buffer overflow, no available space.
Any Idea why ?
By the way, your demo code is awesome :)
I do not know - sorry - I specifically avoided demo of notifications / messaging until now because it is a very complicated bit of code. I had mine working at least using all the versions shown above up through RN0.59.10 but I haven't tested my RN0.60 port yet in my work app, so I can't even claim it works, though it should?
i can confirm it works on RN0.60.4 with RNF5.5.6 and RN0.60.3 with RNF5.5.5 both on debug and release.
please make sure you run npx jetify
before doing ./gradlew assembleRelease
to convert any android.support.v4.app.*
package into androidx.core.app.*
Okay - Thanks for confirming @jagamypriera - I have moved farther in my RN60 conversion as well and it seems to be working for me as well but I have sympathy for anyone setting messaging and notifications up. It’s just hard. But I think this can be closed
To be clear on one thing - there is a change on the tip of the v5.x.x branch that is unreleased (it will be in 5.5.7) that allows for better library specification for AndroidX in react-native 0.60 - I use the branch reference as my dependency currently: https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh#L12
https://github.com/invertase/react-native-firebase/pull/2476
@mikehardy good news, I managed to fix that by re-creating (again) a RN 0.60.3 project from scratch and then adding RNF 5.5.5. I've yet to see what was missing, but now the app builds and run just fine.
Between us, I feel kinda boring the fact that it's nearly impossible to understand what's going on behind the hood: we're basically forced to deal with these "un-debuggable" things by reinstalling from scratch... But hey, at least it works, therefore I can't complain too much I guess :)
If anyone is interested I can publish a GitHub boilerplate with everything set up and (hopefully) working.
@Darkseal It would be nice if you could upload
The script I reference here https://github.com/invertase/react-native-firebase/issues/2332#issuecomment-520248114 will generate a boilerplate for you on demand any time, but (even better than a static boilerplate) it shows you exactly how to do it, and is easy to keep up to date with react-native (e.g., react-native 0.61 is almost out, and all the other boilerplates will be out of date, this one will be up to date immediately)
i can confirm it works on RN0.60.4 with RNF5.5.6 and RN0.60.3 with RNF5.5.5 both on debug and release. please make sure you run
npx jetify
before doing./gradlew assembleRelease
to convert anyandroid.support.v4.app.*
package intoandroidx.core.app.*
Running npx jetify
is perfect for me to solve this issue. I just upgrade react-native to 0.60 encountering this compile issue. Thanks @jagamypriera
work for me
(1) yarn add react-native-firebase => add again (2) npx jetify => run this from root dir second cmd response so like this => Jetifier found 1038 file(s) to forward-jetify. Using 4 workers...
@Darkseal please confirm that after doing the androidx migration (useJetifier=true etc) in AndroidStudio you have also installed the jetifier npm package and run
npx jetifier
. If you have not done that, your build will fail
Thanks man it worked
If you using React-Native 0.60+ make sure to use.
npx jetify
From the project root directory, where the node_modules folder is..
<3
for users using MS App Center to build release, add npx jetify
to appcenter-pre-build.sh
for users using MS App Center to build release, add
npx jetify
toappcenter-pre-build.sh
I tried npx jetify to appcenter-pre-build.sh
it But Still getting the error like below in MS App Center. Can anybody help me?
> Task :react-native-firebase:compileReleaseJavaWithJavac
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/ReactNativeFirebaseAppRegistrar.java:20: error: package android.support.annotation does not exist
import android.support.annotation.Keep;
^
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/ReactNativeFirebaseAppRegistrar.java:29: error: cannot find symbol
@Keep
^
symbol: class Keep
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/storage/RNFirebaseStoragePackage.java:3: error: package android.support.annotation does not exist
import android.support.annotation.RequiresPermission;
^
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseMessaging.java:7: error: cannot find symbol
import android.support.v4.app.NotificationManagerCompat;
^
symbol: class NotificationManagerCompat
location: package android.support.v4.app
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseMessaging.java:8: error: package android.support.v4.content does not exist
import android.support.v4.content.LocalBroadcastManager;
^
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseMessagingService.java:5: error: package android.support.v4.content does not exist
import android.support.v4.content.LocalBroadcastManager;
^
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseBackgroundNotificationActionReceiver.java:8: error: cannot find symbol
import android.support.v4.app.RemoteInput;
^
symbol: class RemoteInput
location: package android.support.v4.app
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotifications.java:10: error: cannot find symbol
import android.support.v4.app.RemoteInput;
^
symbol: class RemoteInput
location: package android.support.v4.app
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotifications.java:11: error: package android.support.v4.content does not exist
import android.support.v4.content.LocalBroadcastManager;
^
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotificationManager.java:20: error: package android.support.annotation does not exist
import android.support.annotation.RequiresApi;
^
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotificationManager.java:21: error: package android.support.v4.content does not exist
import android.support.v4.content.LocalBroadcastManager;
^
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/DisplayNotificationTask.java:15: error: cannot find symbol
import android.support.v4.app.NotificationCompat;
^
symbol: class NotificationCompat
location: package android.support.v4.app
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/DisplayNotificationTask.java:16: error: cannot find symbol
import android.support.v4.app.RemoteInput;
^
symbol: class RemoteInput
location: package android.support.v4.app
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/DisplayNotificationTask.java:407: error: package NotificationCompat does not exist
private NotificationCompat.Action createAction(
^
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/DisplayNotificationTask.java:494: error: cannot find symbol
private RemoteInput createRemoteInput(Bundle remoteInput) {
^
symbol: class RemoteInput
location: class DisplayNotificationTask
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/analytics/RNFirebaseAnalyticsPackage.java:3: error: package android.support.annotation does not exist
import android.support.annotation.RequiresPermission;
^
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/storage/RNFirebaseStoragePackage.java:17: error: cannot find symbol
@RequiresPermission(
^
symbol: class RequiresPermission
location: class RNFirebaseStoragePackage
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotificationManager.java:370: error: cannot find symbol
@RequiresApi(api = 26)
^
symbol: class RequiresApi
location: class RNFirebaseNotificationManager
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotificationManager.java:384: error: cannot find symbol
@RequiresApi(api = 26)
^
symbol: class RequiresApi
location: class RNFirebaseNotificationManager
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotificationManager.java:398: error: cannot find symbol
@RequiresApi(api = 26)
^
symbol: class RequiresApi
location: class RNFirebaseNotificationManager
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotificationManager.java:414: error: cannot find symbol
@RequiresApi(api = 26)
^
symbol: class RequiresApi
location: class RNFirebaseNotificationManager
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotificationManager.java:457: error: cannot find symbol
@RequiresApi(api = 26)
^
symbol: class RequiresApi
location: class RNFirebaseNotificationManager
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/analytics/RNFirebaseAnalyticsPackage.java:17: error: cannot find symbol
@RequiresPermission(
^
symbol: class RequiresPermission
location: class RNFirebaseAnalyticsPackage
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseMessaging.java:36: error: cannot find symbol
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(context);
^
symbol: class LocalBroadcastManager
location: class RNFirebaseMessaging
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseMessaging.java:36: error: cannot find symbol
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(context);
^
symbol: variable LocalBroadcastManager
location: class RNFirebaseMessaging
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseMessaging.java:90: error: cannot find symbol
Boolean enabled = NotificationManagerCompat
^
symbol: variable NotificationManagerCompat
location: class RNFirebaseMessaging
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseMessagingService.java:26: error: cannot find symbol
LocalBroadcastManager
^
symbol: variable LocalBroadcastManager
location: class RNFirebaseMessagingService
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseMessagingService.java:41: error: cannot find symbol
LocalBroadcastManager
^
symbol: variable LocalBroadcastManager
location: class RNFirebaseMessagingService
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseMessagingService.java:51: error: cannot find symbol
LocalBroadcastManager
^
symbol: variable LocalBroadcastManager
location: class RNFirebaseMessagingService
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseBackgroundNotificationActionReceiver.java:62: error: cannot find symbol
Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
^
symbol: variable RemoteInput
location: class RNFirebaseBackgroundNotificationActionReceiver
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotifications.java:54: error: cannot find symbol
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(context);
^
symbol: class LocalBroadcastManager
location: class RNFirebaseNotifications
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotifications.java:54: error: cannot find symbol
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(context);
^
symbol: variable LocalBroadcastManager
location: class RNFirebaseNotifications
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotifications.java:308: error: cannot find symbol
Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
^
symbol: variable RemoteInput
location: class RNFirebaseNotifications
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotificationManager.java:204: error: cannot find symbol
LocalBroadcastManager
^
symbol: variable LocalBroadcastManager
location: class RNFirebaseNotificationManager
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/DisplayNotificationTask.java:81: error: package NotificationCompat does not exist
NotificationCompat.Builder nb;
^
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/DisplayNotificationTask.java:84: error: package NotificationCompat does not exist
nb = new NotificationCompat.Builder(context, channelId);
^
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/DisplayNotificationTask.java:87: error: package NotificationCompat does not exist
nb = new NotificationCompat.Builder(context);
^
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/DisplayNotificationTask.java:130: error: package NotificationCompat does not exist
NotificationCompat.BigPictureStyle bp = new NotificationCompat.BigPictureStyle();
^
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/DisplayNotificationTask.java:130: error: package NotificationCompat does not exist
NotificationCompat.BigPictureStyle bp = new NotificationCompat.BigPictureStyle();
^
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/DisplayNotificationTask.java:158: error: package NotificationCompat does not exist
NotificationCompat.BigTextStyle bt = new NotificationCompat.BigTextStyle();
^
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/DisplayNotificationTask.java:158: error: package NotificationCompat does not exist
NotificationCompat.BigTextStyle bt = new NotificationCompat.BigTextStyle();
^
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/DisplayNotificationTask.java:361: error: package NotificationCompat does not exist
NotificationCompat.Action action = createAction(context, a, intentClass, notification);
^
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/DisplayNotificationTask.java:424: error: package NotificationCompat.Action does not exist
NotificationCompat.Action.Builder ab = new NotificationCompat.Action.Builder(
^
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/DisplayNotificationTask.java:424: error: package NotificationCompat.Action does not exist
NotificationCompat.Action.Builder ab = new NotificationCompat.Action.Builder(
^
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/DisplayNotificationTask.java:437: error: cannot find symbol
RemoteInput remoteInput = createRemoteInput(ri);
^
symbol: class RemoteInput
location: class DisplayNotificationTask
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/DisplayNotificationTask.java:496: error: package RemoteInput does not exist
RemoteInput.Builder rb = new RemoteInput.Builder(resultKey);
^
/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/notifications/DisplayNotificationTask.java:496: error: package RemoteInput does not exist
RemoteInput.Builder rb = new RemoteInput.Builder(resultKey);
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
47 errors
This looks like incorrect / partial migration to AndroidX. There's an infinite number of ways to do it wrong, the jetifier project page has the instructions on how to do it correctly plus troubleshooting for the main reasons it goes wrong. It's not really a react-native-firebase problem - it's a problem with specific projects not using AndroidX and/or managing their dependencies correctly
Solves my problem
i'm still facing this error. RN: v61.4 react-native-firebase: ~5.5.7
@Drzaln
Thanks for your response @Temirtator i already solved it using multiDex
I've been compiling and building on MS AppCenter, but it all came sudden, I had a build failure with message as below.
Execution failed for task ':react-native-firebase:compileReleaseJavaWithJavac'
I made a clean folder and clone my project again and try to run and build just like as MS AppCenter does. So I had a same error. I tried to run npx jetify
and to build. It works.
So, I made appcenter-pre-build.sh
file with
#!/usr/bin/env bash
# Run jetify for successful compile & build
npx jetify
Then It works successfully through AppCenter build process. Thanks @unicornRainbows @hopewise
But, I'm very curious that jetifier
is already merged into react-native-community/cli
in v.0.61 as far as I know. I'm using react-native
:0.61.2
. And It has been working fine for building so far. Why this happened all in sudden? Maybe there were some changes in MS AppCenter.
If you using React-Native 0.60+ make sure to use.
npx jetify
From the project root directory, where the node_modules folder is..
<3
this works for me. thanks, u save my life
npx jetify ./gradlew app:assembleRelease
@Darkseal please confirm that after doing the androidx migration (useJetifier=true etc) in AndroidStudio you have also installed the jetifier npm package and run
npx jetifier
. If you have not done that, your build will fail
Thank you very much
@mikehardy yes i have
npx jetify
in mypostinstall
and it fires properly.Today I tried to fix by upgrading from 0.60.0 to 0.60.3, following the upgrade helper: the error is still the same but the offending
.java
class changed:MainActivity.java:5: error: cannot access ViewGroup public class MainActivity extends ReactActivity { ^ class file for android.view.ViewGroup not found 1 error
Any advice?
Thanks! you helped me a lot.
i'm still facing this error
and
"react-native-firebase": "^5.6.0",
"react-native": "0.62.2",
please tell me what should i do ?
@Ritikkk09 you should not under any circumstances use 1) react-native-firebase v5.x.x, we are on v14.x.x now, upgrade immediately and 2) use react-native 0.62.x - it does not even compile with current Xcode, you should use at least 0.65.x but react-native 0.67.1 is out and it's current stable.
In short: use current stable release versions of your software, and things should work, but if they do not at least you will be able to access support. With the versions you specify there is no support offered
@Darkseal please confirm that after doing the androidx migration (useJetifier=true etc) in AndroidStudio you have also installed the jetifier npm package and run
npx jetifier
. If you have not done that, your build will fail
THIS IS IS HELPED ME!
npx jetifier
Just a note, I wrote the jetifier command along with some other community members. You should not need to run it anymore, I personally do not use my own jetifier package anymore! If you still need it, you are using packages that are outdated and possibly no longer maintained, and you should investigate that and pursue some sort of upgrade or fix for the package that still needs it, or switch to a similar package that is maintained.
As @mikehardy mentioned, NO JETIFIER IS NEEDED when using newer versions of RN.
The issue looks more like ~ this has to do with the Gradle JDK version.
I had JDK 8 and the issue persisted even after fresh installations, cleans and even after manual Jetifying (certainly was not necessary, still I tried my luck)
However, as soon as I changed the version to OpenJDK 11, the issue is gone.
Steps to change the JDK version in Android Studio under gradle:
Preferences > Build, Execution, Deployment > Build Tools > Gradle > Gradle JDK
Thanks to this thread on SO: https://stackoverflow.com/questions/69862012/task-react-native-firebase-messagingcompiledebugjavawithjavac-failed
@surajj2223 you wlil likely need JDK11 these days, because using Android SDK31 for either compile version or target version will require JDK11, but this was about older AndroidX transitions originally, it was a different issue to start
Hey Mike! I just faced similar issue of react-native-firebase_messaging:compileDebugJavaWithJavac FAILED]
for messaging 14.7
which got fixed with JDK 11. And yes this specific issue was different.
I had a similar error
Versions:
"react-native": "0.66.4",
"@react-native-firebase/analytics": "^14.7.0",
"@react-native-firebase/app": "^14.7.0",
"@react-native-firebase/crashlytics": "^14.7.0",
"@react-native-firebase/messaging": "^14.7.0",
Error:
> Task :react-native-firebase_messaging:compileDebugJavaWithJavac FAILED
Seems like updating the JDK fixed the issue
admin@Admins-MacBook-Pro mobile % java -version
openjdk version "11.0.14.1" 2022-02-08 LTS
OpenJDK Runtime Environment Corretto-11.0.14.10.1 (build 11.0.14.1+10-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.14.10.1 (build 11.0.14.1+10-LTS, mixed mode)
I am also facing a similar kind of issue
Task :react-native-firebase:compileDebugJavaWithJavac FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
how can I fix it?
@prashantkr006 that is not a build error. That is a notice saying there was a build error. You need to find the actual build error (higher up in the logs) and post that for people to have any ideas on how to help.
I had a similar error
Versions:
"react-native": "0.66.4", "@react-native-firebase/analytics": "^14.7.0", "@react-native-firebase/app": "^14.7.0", "@react-native-firebase/crashlytics": "^14.7.0", "@react-native-firebase/messaging": "^14.7.0",
Error:
> Task :react-native-firebase_messaging:compileDebugJavaWithJavac FAILED
Seems like updating the JDK fixed the issue
admin@Admins-MacBook-Pro mobile % java -version openjdk version "11.0.14.1" 2022-02-08 LTS OpenJDK Runtime Environment Corretto-11.0.14.10.1 (build 11.0.14.1+10-LTS) OpenJDK 64-Bit Server VM Corretto-11.0.14.10.1 (build 11.0.14.1+10-LTS, mixed mode)
Thank you, this really works
Issue
My project was working fine, i have done npm install or not sure, but suddenly its stopped working and started some error, so i have done lot of changes used jetifier , updated react native and firebase version but dont know still its giving me error My complete error
Project Files
React Native
Click To Expand
#### `package.json`: ```ruby "react-native": "0.60.0", "react-native-firebase": "5.5.4", "jetifier": "^1.6.1", // added this from few suggestions ```
Android
Click To Expand
#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [x] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [x] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`: ```groovy buildscript { ext { buildToolsVersion = "28.0.3" minSdkVersion = 16 compileSdkVersion = 28 targetSdkVersion = 28 supportLibVersion = "28.0.0" } repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.3.2' classpath 'com.google.gms:google-services:4.2.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { mavenLocal() google() jcenter() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url "$rootDir/../node_modules/react-native/android" } maven { url 'https://maven.google.com/' name 'Google' } } } ``` #### `android/app/build.gradle`: ```groovy project.ext.react = [ entryFile: "index.js" ] apply from: "../../node_modules/react-native/react.gradle" /** * Set this to true to create two separate APKs instead of one: * - An APK that only works on ARM devices * - An APK that only works on x86 devices * The advantage is the size of the APK is reduced by about 4MB. * Upload all the APKs to the Play Store and people will download * the correct one based on the CPU architecture of their device. */ def enableSeparateBuildPerCPUArchitecture = true /** * Run Proguard to shrink the Java bytecode in release builds. */ def enableProguardInReleaseBuilds = true android { compileSdkVersion rootProject.ext.compileSdkVersion compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } defaultConfig { applicationId "com.application" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 30 versionName "2.1.2" // multiDexEnabled true } splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk true // If true, also generate a universal APK include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" } } buildTypes { release { minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } } // applicationVariants are e.g. debug, release applicationVariants.all { variant -> variant.outputs.each { output -> // For each separate APK per architecture, set a unique version code as described here: // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4] def abi = output.getFilter(OutputFile.ABI) if (abi != null) { // null for the universal-debug, universal-release variants output.versionCodeOverride = versionCodes.get(abi) * 1048576 + defaultConfig.versionCode } } } } dependencies { implementation project(':react-native-firebase') implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" implementation "com.facebook.react:react-native:+" // From node_modules implementation "com.facebook.fresco:animated-gif:1.10.0" implementation "com.facebook.fresco:animated-webp:1.10.0" implementation "com.facebook.fresco:webpsupport:1.9.0" implementation "com.google.android.gms:play-services-base:16.1.0" implementation "com.google.firebase:firebase-core:16.0.8" implementation "com.google.firebase:firebase-messaging:17.5.0" implementation 'me.leolin:ShortcutBadger:1.1.21@aar' // implementation "com.google.firebase:firebase-config:16.0.0" // implementation 'com.android.support:multidex:1.0.3' } // Run this once to be able to run the application with BUCK // puts all compile dependencies into folder libs for BUCK to use task copyDownloadableDepsToLibs(type: Copy) { from configurations.compile into 'libs' } apply plugin: 'com.google.gms.google-services' ``` #### `android/settings.gradle`: ```groovy rootProject.name = 'myapp' include ':react-native-firebase' project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android') include ':react-native-push-notification' project(':react-native-push-notification').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-push-notification/android') include ':app' ``` #### `MainApplication.java`: ```java // N/A ``` #### `AndroidManifest.xml`: ```xml ```
Environment
Click To Expand
**`react-native info` output:** ``` React Native Environment Info: System: OS: macOS High Sierra 10.13.4 CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz Memory: 268.25 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 10.15.3 - /usr/local/bin/node Yarn: 1.1.0 - /usr/local/bin/yarn npm: 6.4.1 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3 Android SDK: API Levels: 19, 22, 23, 24, 25, 26, 27, 28 Build Tools: 26.0.2, 27.0.3, 28.0.2, 28.0.3 System Images: android-22 | Android TV Intel x86 Atom, android-22 | Google APIs Intel x86 Atom_64, android-28 | Android TV Intel x86 Atom, android-Q | Google APIs Intel x86 Atom IDEs: Xcode: 9.4/9F1027a - /usr/bin/xcodebuild npmPackages: react: 16.8.3 => 16.8.3 react-native: 0.60.0 => 0.59.0 npmGlobalPackages: create-react-native-app: 1.0.0 react-native-cli: 2.0.1 react-native-create-library: 3.1.2 react-native-vector-icons: 4.4.0 ``` - **Platform that you're experiencing the issue on**: - [ ] iOS - [x] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `5.5.4` - **`Firebase` module(s) you're using that has the issue:** - `e.g. Instance ID` - **Are you using `TypeScript`?** - `N`
Think
react-native-firebase
is great? Please consider supporting all of the project maintainers and contributors by donating via our Open Collective where all contributors can submit expenses. [Learn More]React Native Firebase
andInvertase
on Twitter for updates on the library.