invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.69k stars 2.21k forks source link

[🐛] Task :react-native-firebase_app:packageDebugResources FAILED #7941

Closed Joshman1412 closed 1 month ago

Joshman1412 commented 3 months ago

Issue

Describe your issue here build keeps failing due to many issues with fire base and now im getting this when i try to build Task :react-native-firebase_app:packageDebugResources FAILED

FAILURE: Build failed with an exception.

Project Files

Javascript

Click To Expand

#### `package.json`: ```json { "name": "GrooveSwap", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "lint": "eslint .", "start": "react-native start", "test": "jest", "postinstall": "jetify" }, "dependencies": { "@expo/plist": "^0.1.3", "@expo/vector-icons": "^14.0.2", "@fortawesome/fontawesome-free": "^6.6.0", "@fortawesome/fontawesome-svg-core": "^6.6.0", "@fortawesome/free-solid-svg-icons": "^6.6.0", "@fortawesome/react-fontawesome": "^0.2.2", "@picovoice/react-native-voice-processor": "^1.2.2", "@react-native-async-storage/async-storage": "^1.24.0", "@react-native-community/cli": "^14.0.0", "@react-native-community/geolocation": "^3.3.0", "@react-native-community/masked-view": "^0.1.11", "@react-native-firebase/app": "^20.3.0", "@react-native-firebase/auth": "^20.3.0", "@react-native-firebase/database": "^20.3.0", "@react-native-firebase/firestore": "^20.3.0", "@react-navigation/bottom-tabs": "^6.6.1", "@react-navigation/native": "^6.1.18", "@react-navigation/stack": "^6.4.1", "axios": "^1.7.2", "firebase": "^10.12.4", "geolib": "^3.3.4", "patch-package": "^8.0.0", "postinstall-postinstall": "^2.1.0", "react": "18.2.0", "react-native": "0.74.3", "react-native-ble-plx": "^3.2.1", "react-native-config": "^1.5.2", "react-native-geolocation-service": "^5.3.1", "react-native-gesture-handler": "^2.17.1", "react-native-maps": "^1.17.1", "react-native-music-control": "^1.4.1", "react-native-permissions": "^4.1.5", "react-native-reanimated": "^3.14.0", "react-native-safe-area-context": "^4.10.8", "react-native-screens": "^3.32.0", "xml2js": "^0.6.2", "yard": "^1.0.3" }, "devDependencies": { "@babel/core": "^7.20.0", "@babel/preset-env": "^7.20.0", "@babel/runtime": "^7.20.0", "@react-native/babel-preset": "0.74.85", "@react-native/eslint-config": "0.74.85", "@react-native/metro-config": "0.74.85", "@react-native/typescript-config": "0.74.85", "@types/react": "^18.2.6", "@types/react-test-renderer": "^18.0.0", "babel-jest": "^29.6.3", "eslint": "^8.19.0", "jest": "^29.6.3", "jetifier": "^2.0.0", "prettier": "2.8.8", "react-test-renderer": "18.2.0", "typescript": "5.0.4" }, "engines": { "node": ">=18" } } ``` #### `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? - [x] 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 = "34.0.0" minSdkVersion = 28 compileSdkVersion = 34 targetSdkVersion = 34 ndkVersion = "26.1.10909125" kotlinVersion = "1.9.22" } repositories { google() mavenCentral() } dependencies { // Use the appropriate version of Gradle plugin classpath("com.android.tools.build:gradle:8.2.1") // Ensure this matches the Gradle version you're using classpath("com.facebook.react:react-native-gradle-plugin") classpath("com.google.gms:google-services:4.3.15") classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" } } allprojects { repositories { google() mavenCentral() maven { url 'https://maven.google.com' } } tasks.withType(JavaCompile) { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } } task clean(type: Delete) { delete rootProject.buildDir } ``` #### `android/app/build.gradle`: ```groovy apply plugin: 'com.android.application' apply plugin: 'org.jetbrains.kotlin.android' apply plugin: 'com.facebook.react' apply plugin: 'com.google.gms.google-services' // Add this line at the end android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { applicationId "com.grooveswap" // Ensure this matches your namespace minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" } compileOptions { sourceCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { jvmTarget = "17" } signingConfigs { debug { storeFile file('debug.keystore') storePassword 'android' keyAlias 'androiddebugkey' keyPassword 'android' } } buildTypes { debug { signingConfig signingConfigs.debug } release { signingConfig signingConfigs.debug minifyEnabled false // Set to true if you want Proguard enabled proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" } } namespace "com.grooveswap" // Ensure this matches your namespace } dependencies { implementation 'com.facebook.react:react-native:+' implementation "org.jetbrains.kotlin:kotlin-stdlib:1.9.22" // Replace with your Kotlin version implementation 'com.facebook.react:react-native:0.74.0' // Ensure this matches your React Native version implementation(platform("com.google.firebase:firebase-bom:33.1.2")) implementation("com.google.firebase:firebase-auth") implementation ("com.google.firebase:firebase-analytics") implementation("com.google.firebase:firebase-firestore") if (project.hasProperty('hermesEnabled') && project.hermesEnabled.toBoolean()) { implementation("com.facebook.react:hermes-android") } else { implementation "org.webkit:android-jsc:+" } } apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle") applyNativeModulesAppBuildGradle(project) tasks.whenTaskAdded { task -> if (task.name == 'checkDebugAarMetadata') { task.dependsOn(':@react-native-firebase_auth:writeDebugAarMetadata') } tasks.whenTaskAdded { t -> if (t.name == 'react-native-firebase_app:packageDebugResources') { t.dependsOn tasks.named('react-native-firebase_app:generateDebugResValues') } } } ``` #### `android/settings.gradle`: ```groovy rootProject.name = 'GrooveSwap' apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle") applyNativeModulesSettingsGradle(settings) include ':app' includeBuild('../node_modules/@react-native/gradle-plugin') include ':@react-native-firebase_app' project(':@react-native-firebase_app').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-firebase/app/android') include ':@react-native-firebase_auth' project(':@react-native-firebase_auth').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-firebase/auth/android') ``` #### `MainApplication.java`: ```java package com.grooveswap import android.app.Application import com.facebook.react.PackageList import com.facebook.react.ReactApplication import com.facebook.react.ReactHost import com.facebook.react.ReactNativeHost import com.facebook.react.ReactPackage import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost import com.facebook.react.defaults.DefaultReactNativeHost import com.facebook.soloader.SoLoader import java.util.Arrays class MainApplication : Application(), ReactApplication { override val reactNativeHost: ReactNativeHost = object : DefaultReactNativeHost(this) { override fun getPackages(): List = PackageList(this).packages.apply { } override fun getJSMainModuleName(): String = "index" override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED } override val reactHost: ReactHost get() = getDefaultReactHost(applicationContext, reactNativeHost) override fun onCreate() { super.onCreate() SoLoader.init(this, false) if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { // If you opted-in for the New Architecture, we load the native entry point for this app. load() } } } ``` #### `AndroidManifest.xml`: ```xml ```


Environment

Click To Expand

**`react-native info` output:** ``` C:\App Development\GrooveSwap>npx react-native info info Fetching system and libraries information... System: OS: Windows 11 10.0.22631 CPU: "(12) x64 AMD Ryzen 5 2600 Six-Core Processor " Memory: 1.16 GB / 15.91 GB Binaries: Node: version: 20.15.1 path: C:\Program Files\nodejs\node.EXE Yarn: version: 1.22.22 path: ~\AppData\Roaming\npm\yarn.CMD npm: version: 10.7.0 path: C:\Program Files\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: Not Found Windows SDK: AllowDevelopmentWithoutDevLicense: Enabled IDEs: Android Studio: AI-241.15989.150.2411.11948838 Visual Studio: Not Found Languages: Java: version: 17.0.11 path: C:\Program Files\Java\jdk-17\bin\javac.EXE Ruby: Not Found npmPackages: "@react-native-community/cli": installed: 14.0.0 wanted: ^14.0.0 react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.74.3 wanted: 0.74.3 react-native-windows: Not Found npmGlobalPackages: "*react-native*": Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: Not found newArchEnabled: Not found ``` - **Platform that you're experiencing the issue on**: - [ ] iOS - [ ] Android - [ ] **iOS** but have not tested behavior on Android - [x] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `20.3.0` - **`Firebase` module(s) you're using that has the issue:** - `e.g. Instance ID` - **Are you using `TypeScript`?** - `N`


Lyokone commented 3 months ago

Hello @Joshman1412 have you tried one of the offered solutions?

brunogdsdev commented 2 months ago

same here

Keenan-Softserve commented 2 months ago

Same here

Keenan-Softserve commented 2 months ago

Hello @Joshman1412 have you tried one of the offered solutions?

@Lyokone Which solutions were offered?

brunogdsdev commented 2 months ago

with expo i added:

{
  "expo": {
 "plugins": [
      "@react-native-firebase/app"
   ]
   }
   }

and this added:

android/build.gradle: classpath 'com.google.gms:google-services:4.4.1'

android/app/build.gradle: apply plugin: 'com.google.gms.google-services'

Keenan-Softserve commented 2 months ago

My fix actually was to remove the code instructed for manual linking and allowing auto-linking to do its job.

The docs confused me so I followed the wrong (manual linking) instructions, which caused this problem for me.

russellwheatley commented 2 months ago

Thanks for confirming fix, @Keenan-Softserve. @Joshman1412 - did this resolve your issue?

brunogdsdev commented 2 months ago

@Keenan-Softserve exactly, same here... The docs confused me too so i followed manual linking and the show this error, when remove manual linking and allow auto-linking all is fine

github-actions[bot] commented 1 month ago

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.