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

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

Open
5 of 10 tasks
Joshman1412 opened this issue Jul 25, 2024 · 9 comments
Open
5 of 10 tasks

Comments

@Joshman1412
Copy link

Joshman1412 commented Jul 25, 2024

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.

  • What went wrong:
    A problem was found with the configuration of task ':react-native-firebase_app:packageDebugResources' (type 'MergeResources').
    • Gradle detected a problem with the following location: 'C:\App Development\GrooveSwap\node_modules@react-native-firebase\app\android\build\generated\res\resValues\debug'.

      Reason: Task ':react-native-firebase_app:packageDebugResources' uses this output of task ':@react-native-firebase_app:generateDebugResValues' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.

      Possible solutions:

      1. Declare task ':@react-native-firebase_app:generateDebugResValues' as an input of ':react-native-firebase_app:packageDebugResources'.
      2. Declare an explicit dependency on ':@react-native-firebase_app:generateDebugResValues' from ':react-native-firebase_app:packageDebugResources' using Task#dependsOn.
      3. Declare an explicit dependency on ':@react-native-firebase_app:generateDebugResValues' from ':react-native-firebase_app:packageDebugResources' using Task#mustRunAfter.

Project Files

Javascript

Click To Expand

package.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:

# N/A

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
# N/A

AppDelegate.m:

// 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?
  • I am using the NPM package jetifier for react-native compatibility?

android/build.gradle:

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:

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:

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:

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<ReactPackage> =
            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:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.grooveswap"> <!-- Add your namespace here -->

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

    <application
        android:name=".MainApplication"
        android:label="@string/app_name"
        android:icon="@mipmap/ic_launcher"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:allowBackup="false"
        android:theme="@style/AppTheme">
        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="AIzaSyAa9fP-gB5kAQ_IKx_NXpiKSM4sqsDvNug"/>
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
            android:launchMode="singleTask"
            android:windowSoftInputMode="adjustResize"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>


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
    • 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
Copy link
Contributor

Lyokone commented Jul 29, 2024

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

@brunogdsdev
Copy link

same here

@Keenan-Softserve
Copy link

Same here

@Keenan-Softserve
Copy link

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

@Lyokone Which solutions were offered?

@brunogdsdev
Copy link

brunogdsdev commented Aug 9, 2024

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
Copy link

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
Copy link
Member

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

@brunogdsdev
Copy link

@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

Copy link

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.

@github-actions github-actions bot added the Stale label Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants