Closed prince-housing closed 2 years ago
Same issue @prince-housing did you figure anything out?
@prince-housing that is one of the most worrisome set of gradle files I've ever seen!
You are depending directly on react-native-firebase in gradle, defeating auto-linking, you are directly specifying a messaging dependency in firebase and a firebase bom, defeating all compatibility with react-native-firebase versions (there is no way bom 25 is compatible with react-native-firebase v15+, which requires bom 30+)
Basically, that configuration is not supportable in any way and I would very carefully go about updating dependencies to current and removing as much direct configuration from gradle files and MainApplication as possible, since auto-linking and the react-native modules themselves expect to drive them in their gradle files.
Similarly, the react-native version is 0.63.4 and as that's about 2 years old at this point, with toolchain versions about 2.5 years old (from slightly delayed adoption in react-native then freezing them when the 0.63 release branch was cut) I would just say they are likely not compatible.
Best course is to use https://react-native-community.github.io/upgrade-helper/ to move one react-native minor at a time (63 -> 64, 64 -> 65 etc) adopting the changes from their template in gradle version and gradle plugin version until you get to at least 67
Then you'll have a build with much more modern toolchains that are compatible with each other. At root this will likely be an incompatibility between the gradle and the gradle plugin versions, possibly combined with a need to npx react-native-clean-project
Either way, this is not something I reproduce unfortunately, and in the absence of a reproduction I won't be able to help. I reproduce success all the time using https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh
I think this was the version that was demonstrating success about the time of react-native 0.63, if you change the npx init
line to have --version=0.63.2
maybe it will work https://github.com/mikehardy/rnfbdemo/commit/a3138029cd2c163d6fca49030c09b054a9356787
I get this issue sometimes - originally had some dependencies in build gradle that I've removed on the advice above, but that hasn't fixed it for me. I've found that deleting the file at this path in node modules fixes the error and I can build again:
/Users/xyz/projects/xyz/node_modules/@react-native-firebase/app/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt
I'm stuck on firebase 14, perhaps this doesn't affect later versions, not sure.
Issue
Describe your issue here
getting below error while executing android build after upgrading
gradle
version to7.0.4
, although it is working fine withgradle
version4.0.1
Project Files
Javascript
Click To Expand
#### `package.json`: ```json "dependencies": { "react-native": "0.63.4", // ...... "@react-native-firebase/analytics": "15.1.1", "@react-native-firebase/app": "15.1.1", "@react-native-firebase/crashlytics": "15.1.1", "@react-native-firebase/dynamic-links": "15.1.1", "@react-native-firebase/messaging": "15.1.1", "@react-native-firebase/perf": "15.1.1", "@react-native-firebase/remote-config": "15.1.1", // .... } ``` #### `firebase.json` for react-native-firebase v6: ```json # N/A ```
iOS
Click To Expand
#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby # N/A ``` #### `AppDelegate.m`: ```objc // N/A ```
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? - [x] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`: ```groovy // Top-level build file where you can add configuration options common to all sub-projects/modules. ext { compileSdkVersion = 31 targetSdkVersion = 31 ndkVersion = "21.4.7075529" keystoreProperties = new Properties() } ext { kotlinVersion = '1.3.72' firebaseMessagingVersion = '20.3.0' } //Config for react-native-firebase project.ext { set('react-native', [ versions: [ android : [ minSdk : 22, targetSdk : 31, compileSdk: 31, buildTools: "31.0.0", ndkVersion :"21.4.7075529" ], firebase: [ bom: "30.2.0" ], ], ]) } // ....... buildscript { ext.kotlin_version = "1.5.20" ext.supportLibVersion = "25.3.0" repositories { jcenter() google() mavenCentral() maven { url 'https://maven.google.com/' name 'Google' } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20" classpath "org.jetbrains.kotlin:kotlin-android-extensions:1.5.20" classpath 'com.android.tools.build:gradle:7.0.4' classpath 'com.google.gms:google-services:4.3.12' classpath 'com.google.firebase:perf-plugin:1.3.1' // classpath 'com.bugsnag:bugsnag-android-gradle-plugin:4.+' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.0' } } subprojects { afterEvaluate {project -> if (project.hasProperty("android")) { android { compileSdkVersion 31 buildToolsVersion '31.0.0' } } } project.configurations.all { resolutionStrategy.eachDependency { details -> if (details.requested.group == 'com.android.support' && !details.requested.name.contains('multidex') ) { details.useVersion "31.0.0" } } } } allprojects { repositories { mavenLocal() 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' } maven { // Local Maven repo containing AARs with JSC library built for Android url ("$rootDir/../node_modules/jsc-android/dist") } google() jcenter() maven { url 'https://www.jitpack.io' } } } ``` #### `android/app/build.gradle`: ```groovy def jscFlavor = 'org.webkit:android-jsc:+' // ........... project.ext.react = [ entryFile: "index.js", // whether to bundle JS and assets in debug mode bundleInAlphaDebug : false, // whether to bundle JS and assets in release mode bundleInAlphaRelease: true, // whether to bundle JS and assets in release mode bundleInGammaRelease: true, enableHermes: true ] // .... android { dexOptions { javaMaxHeapSize "2g" } ndkVersion rootProject.ext.ndkVersion compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion "31.0.0" defaultConfig { applicationId "xyz" minSdkVersion 22 targetSdkVersion 30 multiDexEnabled true versionCode 351 versionName "13.2.1" resValue "string", "build_config_package", "xyz" resValue "string", "ktwo", "\"${project.env.get("FACEBOOK_APP_ID")}\"" } // ...... } // ..... def multidex_version = '2.0.1' //...... dependencies { //noinspection GradleDynamicVersion implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" implementation project(':@react-native-firebase_remote-config') implementation project(':@react-native-firebase_perf') // implementation project(':@react-native-firebase_messaging') implementation project(':@react-native-firebase_crashlytics') implementation project(':@react-native-firebase_analytics') implementation project(':@react-native-firebase_app') implementation project(':@react-native-firebase_dynamic-links') implementation "androidx.multidex:multidex:$multidex_version" implementation('androidx.work:work-runtime:2.0.1') { exclude group: "com.google.guava", module: "listenablefuture" } implementation "com.google.code.gson:gson:2.8.0" implementation 'com.google.android.play:core:1.9.0' implementation(project(':react-native-fcm')) { exclude group: 'com.google.firebase' } implementation 'com.facebook.react:react-native:0.61.0' if (enableHermes) { def hermesPath = "../../node_modules/hermes-engine/android/"; debugImplementation files(hermesPath + "hermes-debug.aar") releaseImplementation files(hermesPath + "hermes-release.aar") } else { implementation jscFlavor } implementation "org.jetbrains.kotlin:kotlin-stdlib:1.5.20" implementation "com.google.android.gms:play-services-base:17.5.0" implementation "com.google.android.gms:play-services-maps:17.0.0" implementation "com.google.android.gms:play-services-auth:18.1.0" implementation "com.google.android.gms:play-services-gcm:17.0.0" implementation "com.google.android.gms:play-services-analytics:17.0.0" implementation "com.google.android.gms:play-services-location:17.1.0" implementation "com.google.android.gms:play-services-auth-api-phone:17.5.0" implementation platform('com.google.firebase:firebase-bom:25.12.0') implementation "com.google.firebase:firebase-core" implementation "com.google.firebase:firebase-messaging" implementation "com.google.firebase:firebase-config" implementation "com.google.firebase:firebase-analytics" implementation "com.google.firebase:firebase-perf" implementation "com.google.firebase:firebase-crashlytics" implementation 'com.squareup.retrofit2:converter-gson:2.8.1' implementation 'com.squareup.retrofit2:retrofit:2.8.1' implementation 'com.squareup.okhttp3:okhttp:3.10.0' implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0' implementation 'javax.annotation:javax.annotation-api:1.2' implementation('com.google.auth:google-auth-library-oauth2-http:0.7.0') { exclude module: 'httpclient' } implementation(project(':react-native-geolocation-service')) { exclude group: 'com.google.android.gms', module: 'play-services-location' } implementation 'com.android.installreferrer:installreferrer:1.1' } ``` #### `android/settings.gradle`: ```groovy rootProject.name = 'xyz' include ':@react-native-firebase_dynamic-links' project(':@react-native-firebase_dynamic-links').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-firebase/dynamic-links/android') include ':@react-native-firebase_remote-config' project(':@react-native-firebase_remote-config').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-firebase/remote-config/android') include ':@react-native-firebase_perf' project(':@react-native-firebase_perf').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-firebase/perf/android') include ':@react-native-firebase_messaging' project(':@react-native-firebase_messaging').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-firebase/messaging/android') include ':@react-native-firebase_crashlytics' project(':@react-native-firebase_crashlytics').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-firebase/crashlytics/android') include ':@react-native-firebase_analytics' project(':@react-native-firebase_analytics').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-firebase/analytics/android') include ':@react-native-firebase_app' project(':@react-native-firebase_app').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-firebase/app/android') ``` #### `MainApplication.java`: ```java /// ........ import io.invertase.firebase.config.ReactNativeFirebaseConfigPackage; import io.invertase.firebase.perf.ReactNativeFirebasePerfPackage; import io.invertase.firebase.messaging.ReactNativeFirebaseMessagingPackage; import io.invertase.firebase.crashlytics.ReactNativeFirebaseCrashlyticsPackage; import io.invertase.firebase.analytics.ReactNativeFirebaseAnalyticsPackage; import io.invertase.firebase.app.ReactNativeFirebaseAppPackage; /// ------- public class MainApplication extends MultiDexApplication implements ReactApplication { // ......... @Override protected List getPackages() {
return Arrays.asList(
new MainReactPackage(),
new ReactNativeFirebaseDynamicLinksPackage(),
new ReactNativeFirebaseConfigPackage(),
new ReactNativeFirebasePerfPackage(),
new ReactNativeFirebaseMessagingPackage(),
new ReactNativeFirebaseCrashlyticsPackage(),
new ReactNativeFirebaseAnalyticsPackage(),
new ReactNativeFirebaseAppPackage(),
);
}
//........
```
#### `AndroidManifest.xml`:
```xml
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_stat_notification" />
```
Environment
Click To Expand
**`react-native info` output:** ``` System: OS: macOS 12.4 CPU: (8) x64 Apple M1 Memory: 25.19 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 14.19.0 - ~/.nvm/versions/node/v14.19.0/bin/node Yarn: 1.22.17 - ~/.nvm/versions/node/v14.19.0/bin/yarn npm: 6.14.16 - ~/.nvm/versions/node/v14.19.0/bin/npm Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: API Levels: 28, 29, 30, 31, 32 Build Tools: 28.0.3, 29.0.2, 30.0.2, 30.0.3, 31.0.0, 32.0.0, 33.0.0 System Images: android-32 | Google APIs ARM 64 v8a, android-32 | Google APIs Intel x86 Atom_64 Android NDK: Not Found IDEs: Android Studio: Not Found Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild Languages: Java: 11.0.15 - /Users/princeverma/.jenv/shims/javac Python: Not Found npmPackages: @react-native-community/cli: 2.9.0 => 2.9.0 react: 16.13.1 => 16.13.1 react-native: 0.63.4 => 0.63.4 react-native-macos: Not Found npmGlobalPackages: *react-native*: Not Found ``` - **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:** - `15.1.1` - **`Firebase` module(s) you're using that has the issue:** - "@react-native-firebase/analytics": "15.1.1", - "@react-native-firebase/app": "15.1.1", - "@react-native-firebase/crashlytics": "15.1.1", - "@react-native-firebase/dynamic-links": "15.1.1", - "@react-native-firebase/messaging": "15.1.1", - "@react-native-firebase/perf": "15.1.1", - "@react-native-firebase/remote-config": "15.1.1", - **Are you using `TypeScript`?** - `N`
React Native Firebase
andInvertase
on Twitter for updates on the library.