react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

[🐛] Gradle Build failed firebase_perf:generateDebugRFile - with react native version 0.63.4 , gradleversion : gradle-7.0.2-all

Open chetan-housing opened this issue 2 years ago • 0 comments

Issue

On running npm run install:android script which calls cd android && ./gradlew installDebug

gradle fails with message

* What went wrong:
Execution failed for task ':react-native-firebase_perf:generateDebugRFile'.
> A failure occurred while executing com.android.build.gradle.internal.res.GenerateLibraryRFileTask$GenerateLibRFileRunnable
   > /Users/chetangupta/Desktop/chetan/housing/housing-app/node_modules/@react-native-firebase/app/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt

package.json:

"dependencies": {
    "@babel/preset-typescript": "^7.16.7",
    "@gorhom/bottom-sheet": "4.1.5",
    "@ptomasroos/react-native-multi-slider": "1.0.0",
    "@react-native-async-storage/async-storage": "1.13.2",
    "@react-native-community/cli": "2.9.0",
    "@react-native-community/cli-platform-android": "^8.0.2",
    "@react-native-community/cli-platform-ios": "4.13.0",
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-community/netinfo": "4.1.4",
    "@react-native-community/viewpager": "3.3.0",
    "@react-native-firebase/analytics": "7.6.8",
    "@react-native-firebase/app": "8.4.6",
    "@react-native-firebase/crashlytics": "8.4.10",
    "@react-native-firebase/dynamic-links": "7.5.10",
    "@react-native-firebase/messaging": "7.9.1",
    "@react-native-firebase/perf": "7.4.9",
    "@react-native-firebase/remote-config": "9.0.11",
    "@react-navigation/bottom-tabs": "5.5.2",
    "@react-navigation/material-top-tabs": "5.2.11",
    "@react-navigation/native": "5.6.1",
    "@react-navigation/stack": "5.5.1",
    "@sentry/react-native": "3.4.2",
    "@skele/components": "1.0.0-alpha.30",
    "amplitude-js": "7.4.1",
    "buffer": "5.2.1",
    "bugsnag-react-native": "2.23.10",
    "capitalize": "1.0.0",
    "crypto-js": "3.1.9-1",
    "events": "3.0.0",
    "flux-standard-action": "1.1.0",
    "hermes-engine": "^0.5.2-rc1",
    "hoist-non-react-statics": "1.2.0",
    "i": "^0.3.7",
    "immutable": "3.8.1",
    "jsc-android": "241213.x.x",
    "jssha": "2.3.1",
    "lottie-ios": "3.2.3",
    "lottie-react-native": "5.1.3",
    "moti": "0.17.1",
    "npm": "^8.12.0",
    "patch-package": "^6.4.7",
    "prop-types": "15.6.1",
    "quickblox-react-native-sdk": "^0.5.19-beta",
    "ramda": "0.24.0",
    "react": "16.13.1",
    "react-mixin": "2.0.2",
    "react-native": "0.63.4",
    "react-native-branch": "5.2.1",
    "react-native-calendars": "1.17.6",
    "react-native-code-push": "6.4.0",
    "react-native-cookies": "3.3.0",
    "react-native-date-picker": "3.2.10",
    "react-native-device-info": "8.4.8",
    "react-native-fast-image": "8.3.2",
    "react-native-fbsdk": "3.0.0",
    "react-native-fcm": "16.2.4",
    "react-native-fs": "2.16.6",
    "react-native-geolocation-service": "5.1.1",
    "react-native-gesture-handler": "1.6.1",
    "react-native-google-analytics-bridge": "7.0.0",
    "react-native-google-signin": "2.0.0",
    "react-native-htmlview": "0.13.0",
    "react-native-image-picker": "3.8.1",
    "react-native-keyboard-aware-scroll-view": "0.8.0",
    "react-native-linear-gradient": "2.5.6",
    "react-native-loader": "1.2.1",
    "react-native-modal": "6.5.0",
    "react-native-moengage": "7.3.0",
    "react-native-parallax-scroll-view": "0.20.1",
    "react-native-razorpay": "2.2.2",
    "react-native-reanimated": "2.4.1",
    "react-native-render-html": "^6.3.1",
    "react-native-root-siblings": "2.2.0",
    "react-native-root-toast": "2.2.1",
    "react-native-safe-area-context": "3.0.5",
    "react-native-screens": "2.10.1",
    "react-native-scrollable-tab-view": "1.0.0",
    "react-native-section-list-get-item-layout": "2.2.3",
    "react-native-select-contact": "1.3.2",
    "react-native-share": "4.1.0",
    "react-native-snackbar": "1.0.2",
    "react-native-snap-carousel": "2.4.0",
    "react-native-sound": "0.11.0",
    "react-native-tab-view": "2.15.0",
    "react-native-ux-cam": "5.1.15",
    "react-native-v8": "0.59.10-patch.4",
    "react-native-webp": "git+https://github.com/dbasedow/react-native-webp.git",
    "react-native-webview": "11.2.1",
    "react-native-youtube-iframe": "^2.1.2",
    "react-redux": "7.1.3",
    "react-swipeable-views-native": "0.11.1",
    "react-swipeable-views-utils": "0.11.1",
    "react-timer-mixin": "0.13.3",
    "recyclerlistview": "3.0.5",
    "redux": "4.0.1",
    "redux-actions": "1.2.1",
    "redux-observable": "0.14.1",
    "redux-persist": "5.10.0",
    "redux-persist-migrate": "4.1.0",
    "redux-thunk": "2.3.0",
    "rxjs": "5.0.3",
    "stacktrace-parser": "0.1.4",
    "truncate-html": "1.0.1",
    "url": "0.11.0"
  },

firebase.json for react-native-firebase v6:

# N/A

Android

Click To Expand Unable to build apk.

Firebase android SDK version

project.ext {
    set('react-native', [
            versions: [
                    android : [
                            minSdk    : 22,
                            targetSdk : 31,
                            compileSdk: 31,
                            buildTools: "31.0.0",
                            ndkVersion :"21.4.7075529"

                            
                    ],
                    firebase: [
                            **bom           : "25.12.0"**
                    ],
            ],
    ])
}
* What went wrong:
Execution failed for task ':react-native-firebase_perf:generateDebugRFile'.
> A failure occurred while executing com.android.build.gradle.internal.res.GenerateLibraryRFileTask$GenerateLibRFileRunnable
   > /Users/chetangupta/Desktop/chetan/housing/housing-app/node_modules/@react-native-firebase/app/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt

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/app/build.gradle:

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.3'
        classpath 'com.google.firebase:perf-plugin:1.3.1'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
    }
}

android/settings.gradle:

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:

public class MainApplication extends MultiDexApplication implements ReactApplication {
....
@Override
        protected List<ReactPackage> getPackages() {
            return Arrays.<ReactPackage>asList(
                    new MainReactPackage(),
                    ...
                    new ReactNativeFirebaseDynamicLinksPackage(),
                    new ReactNativeFirebaseConfigPackage(),
                    new ReactNativeFirebasePerfPackage(),
                    new ReactNativeFirebaseMessagingPackage(),
                    new ReactNativeFirebaseCrashlyticsPackage(),
                    new ReactNativeFirebaseAnalyticsPackage(),
                    new ReactNativeFirebaseAppPackage(),
                    ...
            );
        }
...
}

AndroidManifest.xml:


...
 <application...>
       android:resource="@string/asset_statements" />
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@drawable/ic_stat_notification" />
        <!-- Set color used with incoming notification messages. This is used when no color is set for the incoming
             notification message. See README(https://goo.gl/6BKBk7) for more. -->
        <meta-data
            tools:replace="android:resource"
            android:name="com.google.firebase.messaging.default_notification_color"
            android:resource="@color/primaryPurple" />

        <meta-data android:name="com.truecaller.android.sdk.PartnerKey" android:value="${truecaller_api_key}"/>

        <!-- [START messaging services] -->
        <service android:name="com.locon.housing.notification.HousingMessagingService"
            android:enabled="true" android:exported="true">
            <intent-filter android:priority="1000">
                <action android:name="com.google.firebase.MESSAGING_EVENT"/>
            </intent-filter>
        </service>
        
        <service android:name="com.evollu.react.fcm.InstanceIdService"
            android:exported="false">
            <intent-filter>
                <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
            </intent-filter>
        </service>
<!-- [END messaging] -->
...
 </application>

chetan-housing avatar Aug 09 '22 11:08 chetan-housing

getting the same issue. "build fails with package-aware-r.txt error". Any help anyone?

kshitijGulati93 avatar Aug 16 '22 04:08 kshitijGulati93

I expect this may be a problem with old toolchain (gradle / gradle plugin) versions or Java (8 vs 11) versions but I can't be sure as I can't reproduce it to then try upgrading them.

All I know is that it definitely works with the set of tools in use in our CI now, you can see all dependencies / versions of tools in use in our CI runs for android E2E and the related code in the tests directory here

Somewhere in the difference between what we have in tests/**/build.gradle + tests/**gradle files + JDK11 and what is in use in your project is the problem

In general, when dealing with code bases that are built on really outdated software (like react-native 0.63) I try to update the basic software / dependencies and then see if I can reproduce. That's important because any fix you need is probably already in the newer software (like, react-native using updated gradle dependencies etc) https://react-native-community.github.io/upgrade-helper/

mikehardy avatar Aug 16 '22 15:08 mikehardy

I don't reproduce this and react-native 0.63 is more than 2 years old, I'm going to close this as not actionable

mikehardy avatar Aug 24 '22 03:08 mikehardy