When I try to build for production this error comes up
Asked Answered
U

6

9

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

Univalence answered 12/11, 2022 at 22:13 Comment(1)
This might help github.com/facebook/react-native/issues/35210Megmega
B
18

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"
               }
           }
       }
       
       }
Barozzi answered 17/11, 2022 at 5:8 Comment(0)
B
5

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

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

Boudreaux answered 14/11, 2022 at 13:29 Comment(1)
Lost a whole day with this problem. Finally, once only, I actually am not at fault for a bug lmaoHereinafter
C
2

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.

Charmion answered 14/3, 2023 at 8:5 Comment(0)
F
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

Flown answered 28/3, 2023 at 19:3 Comment(2)
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 ?Guru
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. github.com/facebook/react-native/issues/…Flown
R
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

Row answered 17/1, 2023 at 1:37 Comment(0)
X
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

Xeric answered 14/11, 2022 at 14:7 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.