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

Android Build Error with RN 59 #3492

Closed
2 of 8 tasks
amiinous opened this issue Apr 18, 2020 · 8 comments
Closed
2 of 8 tasks

Android Build Error with RN 59 #3492

amiinous opened this issue Apr 18, 2020 · 8 comments

Comments

@amiinous
Copy link

Issue

I'm using react-native-firebase with RN 0.59.8 (without AndroidX). I use reverse-jetify as a post-install script. During android build I come up with following build error which is apparently due to androidX issues. As of now I cannot migrate to AndroidX.

import android.support.annotation.Keep;
                                 ^
/Users/***/node_modules/@react-native-firebase/app/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseAppRegistrar.java:31: error: cannot find symbol
@Keep
 ^
  symbol: class Keep
/Users/***/node_modules/@react-native-firebase/app/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseInitProvider.java:26: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
                                 ^
/Users/***/node_modules/@react-native-firebase/app/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseEventEmitter.java:22: error: package android.support.annotation does not exist
import android.support.annotation.MainThread;
                                 ^
/Users/***/node_modules/@react-native-firebase/app/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseInitProvider.java:71: error: cannot find symbol
  @Nullable
   ^
  symbol:   class Nullable
  location: class ReactNativeFirebaseInitProvider
/Users/***/node_modules/@react-native-firebase/app/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseInitProvider.java:79: error: cannot find symbol
  @Nullable
   ^
  symbol:   class Nullable
  location: class ReactNativeFirebaseInitProvider
/Users/***/node_modules/@react-native-firebase/app/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseInitProvider.java:85: error: cannot find symbol
  @Nullable
   ^
  symbol:   class Nullable
  location: class ReactNativeFirebaseInitProvider
/Users/***/node_modules/@react-native-firebase/app/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseEventEmitter.java:121: error: cannot find symbol
  @MainThread
   ^
  symbol:   class MainThread
  location: class ReactNativeFirebaseEventEmitter
/Users/***/node_modules/@react-native-firebase/app/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseEventEmitter.java:133: error: cannot find symbol
  @MainThread
   ^
  symbol:   class MainThread
  location: class ReactNativeFirebaseEventEmitter

Project Files

Android

Click To Expand

Have you converted to AndroidX?

  • my application is an AndroidX application?
  • I am using android/gradle.settings jetifier=true for Android compatibility?
  • I am using the NPM package jetifier for react-native compatibility?

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->


Environment

Click To Expand

react-native info output:

 React Native Environment Info:
    System:
      OS: macOS 10.15.2
      CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
      Memory: 66.59 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.16.2 - /usr/local/bin/node
      Yarn: 1.3.2 - /usr/local/bin/yarn
      npm: 6.9.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
      Android SDK:
        API Levels: 23, 25, 26, 27, 28, 29
        Build Tools: 23.0.1, 25.0.0, 25.0.1, 25.0.2, 26.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.2, 28.0.3
    IDEs:
      Android Studio: 3.5 AI-191.8026.42.35.5977832
      Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3 
      react-native: 0.59.8 => 0.59.8 
    npmGlobalPackages:
      create-react-native-app: 1.0.0
  • Platform that you're experiencing the issue on:
    • iOS
    • 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:
    • 6.4.0
  • Firebase module(s) you're using that has the issue:
    • App
  • Are you using TypeScript?
    • N


@mikehardy
Copy link
Collaborator

react-native-firebase v6 is only supported for react-native 0.60+

This will sound harsh but please understand I wrote the jetifier you are using because I understand the pain of the upgrade from RN59 to RN60+ and the AndroidX switch. I sympathize - I wrote it to support people that had to delay. The harsh part is that you are out of time though - you really need to upgrade

Luckily, the Android Studio process to do the upgrade (and then jetifier but in the forward direction) make it not so painful. The hardest part for me after that was the Xcode iOS part - converting to cocoapods etc. No sugar-coating that, it's painful. But RN60 is needed for proper support of Xcode 11 (which is needed for iOS13 etc) and it's been about a year now

You may be able to work around this by adding an annotation dependency in your app/build.gradle but I'm not sure

@amiinous
Copy link
Author

@mikehardy Yes I will consider the upgrade sometime in the future. Until then I will be using V5.
Btw, I really appreciate the brand new docs page, however, there is no statement about react-native-firebase v6 is only supported for react-native 0.60+ which may be confusing.

@mikehardy
Copy link
Collaborator

@Salakar this is a fair point - https://rnfirebase.io/#prerequisites could perhaps state RN60+ as a requirement (and if I am not mistaken, also iOS10+ but I could be wrong there)

The supported versions matrix for v5 was a bit gnarly but was still useful to refer people to: https://v5.rnfirebase.io/docs/v5.x.x/getting-started#Supported-versions---React-Native-/-Firebase

@code-by
Copy link

code-by commented Oct 21, 2021

Hi
I use RN 0.60.5 in one of my project with react-native-firebase v5.6, I need add Crashlytics there. As far I understand, I need use react-native-firebase at least v.6 to do this. Which most recent version of react-native-firebase is supported with RN 0.60.5 ?
thank you

@mikehardy
Copy link
Collaborator

I'm not sure, that's a version from more than 2 years ago. We don't test old versions normally, since the software's free and generally pretty easy to upgrade from version to version we expect people to adopt new releases.

Rather than face possible (probable!) incompatibilities I'd prioritize working through the upgrade. I just scanned it and it's not so bad: https://react-native-community.github.io/upgrade-helper/?from=0.60.5&to=0.66.1

A big chunk of it is auto-generated by ./gradlew wrapper in ./android after you change your gradle version in gradle.properties, and a storyboard file that you likely don't need to mess with (you already had to change to a storyboard to get App Store approval these days I think? And react-native-bootsplash does it for you anyway).

Then you'll know it just works and we actually test it. I think we still have a lot of users back on 0.63 but the diff on upgrade-helper looks almost the same! The changes got much much smaller as it went to 64 65 and then 66.

@mikehardy
Copy link
Collaborator

I had an unrelated issue which caused me to do some research today on minimum supported versions.
Here are the things to keep in mind:

Sure, there are a couple months to go but those are months full of holidays etc. I would strongly prioritize updating to react-native 0.62 and using Xcode 13 in your build environment.

Once you've done that, might as well go to 0.66, the further upgrades are pretty easy.

Then you may access the current versions here and throughout the react-native ecosyste with no questions or fear.

@code-by
Copy link

code-by commented Oct 26, 2021

Hi
Sorry for may be stupid question, I need receive push notifications from AWS too (one of third-party services used in our app use them), so could 'firebase/messaging' v5 or latest receive PN also from AWS?

@mikehardy
Copy link
Collaborator

Hi @code-by it appears that AWS SNS is compatible with FCM and APNS and those are the services that firebase messaging uses https://docs.aws.amazon.com/sns/latest/dg/sns-prerequisites-for-mobile-push-notifications.html

Definitely use current versions of anything you're trying to do, so not v5 here, you'll want the current release (12.9.3 at the moment)

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

3 participants