8

When I try to build for production, this error comes up. I'm using React Native Firebase. This error happens on android.

Here is the error

* What went wrong:
Execution failed for task ':react-native-firebase_app:generateReleaseRFile'.
> Could not resolve all files for configuration ':react-native-firebase_app:releaseCompileClasspath'.
   > Failed to transform react-native-0.71.0-rc.0-release.aar (com.facebook.react:react-native:0.71.0-rc.0) to match attributes {artifactType=android-symbol-with-package-name, com.android.build.api.attributes.BuildTypeAttr=release, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-api}.
      > Could not find react-native-0.71.0-rc.0-release.aar (com.facebook.react:react-native:0.71.0-rc.0).
        Searched in the following locations:
            https://repo.maven.apache.org/maven2/com/facebook/react/react-native/0.71.0-rc.0/react-native-0.71.0-rc.0-release.aar

Here are my packages

[tag:    "@react-native-async-storage/async-storage": "^1.17.10",
    "@react-native-firebase/analytics": "^16.4.3",
    "@react-native-firebase/app": "^16.4.3",
    "@react-navigation/bottom-tabs": "^6.4.0",
    "@react-navigation/native": "^6.0.13",
    "@react-navigation/native-stack": "^6.9.1",
    "@rneui/base": "^4.0.0-rc.7",
    "@rneui/themed": "^4.0.0-rc.7",
    "meilisearch": "^0.29.1",
    "native-base": "^3.4.21",
    "picomatch": "^2.3.1",
    "react": "18.1.0",
    "react-native": "0.70.3",
    "react-native-firebase": "^5.6.0",
    "react-native-google-mobile-ads": "^8.2.1",
    "react-native-navigation-bar-color": "^2.0.1",
    "react-native-safe-area-context": "^4.4.1",
    "react-native-screens": "^3.18.2",
    "react-native-svg": "^13.5.0",
    "react-native-vector-icons": "^9.2.0"]

If you can help, thanks!

I have tried everything I could find online =(

I have also tried npx jetify

Ken White
  • 123,280
  • 14
  • 225
  • 444
Struan Mclean
  • 111
  • 1
  • 3

6 Answers6

17

Try this

add these lines into android/build.gradle File

allprojects {
    repositories {
        google()

         exclusiveContent {
           filter {
               includeGroup "com.facebook.react"
           }
           forRepository {
               maven {
                   url "$rootDir/../node_modules/react-native/android"
               }
           }
       }
       
       }
Pranavan
  • 201
  • 1
  • 3
5

This is a bug with react native, a fix has been released.

Check https://github.com/facebook/react-native/issues/35210

General Grievance
  • 4,555
  • 31
  • 31
  • 45
2

I was able to fix the issue by updating the version of react native to the latest patch.

Native version Update to
0.70.x 0.70.5
0.69.x 0.69.7
0.68.x 0.68.5
0.67.x 0.67.5
0.66.x 0.66.5
0.65.x 0.65.3
0.64.x 0.64.4
0.63.x 0.63.5

Link to the source: https://github.com/facebook/react-native/issues/35210

General Grievance
  • 4,555
  • 31
  • 31
  • 45
Nawfal Haddi
  • 89
  • 1
  • 5
  • i am using 0.71, i upgraded from 0.60, but this error is still there for android when i am running react-native run-android! Any suggestions ? – Ankit Apr 18 '23 at 16:07
  • if you are using a react native version lower than 0.63, you need to fix it manually please refer to this link to see how to fix it. https://github.com/facebook/react-native/issues/35210#:~:text=Fix%20for%20older%20react%2Dnative%20(%3C%200.63) – Nawfal Haddi Apr 19 '23 at 17:14
1

Make sure that your react-native version in your app/build.gradle matches your version in the package.json:

app/build.gradle

implementation "com.facebook.react:react-native:0.70.+"

package.json

"react-native": "0.70.5"

this works for me

1

You can check this link to know what exactly the problem is: No matching variant of com.facebook.react:react-native:0.71.0-rc.0 was found

Solution 1:

Just update your react native version to 0.71 and npm install.

Solution 2:

I was using react native version 0.69.4 and this code helped me to fix it by adding into my android/build.gradle file.

allprojects {
repositories {
    google()

     exclusiveContent {
       filter {
           includeGroup "com.facebook.react"
       }
       forRepository {
           maven {
               url "$rootDir/../node_modules/react-native/android"
           }
       }
   }
   
   }

Hope this helps you and anyone going through this problem.

0

as the first answer said it's issue in maven central and react-native resolved that here https://github.com/facebook/react-native/issues/35210.... in package.json file update react-native by replace this line

 "react-native": "0.70.5"

then npm install

karim elsaidy
  • 876
  • 8
  • 5