7

i got a bug when i build react native apk. last week I built no error. but now an error occurs, even though there is no new package that I installed.

Task :react-native-async-storage_async-storage:generateReleaseRFile FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-async-storage_async-storage:generateReleaseRFile'.
> Could not resolve all files for configuration ':react-native-async-storage_async-storage: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     

i wish i could build apk

1

3 Answers 3

7

hope this can help you [FIXED] Android build failures No matching variant of com.facebook.react:react-native:0.71.0-rc.0 was found

Sign up to request clarification or add additional context in comments.

Comments

0

in my case it was because of using maven's react native version how I fixed it. android/build.gradle

    mavenCentral()
    jcenter()
    exclusiveContent {
       filter {
           includeGroup "com.facebook.react"
       }
       forRepository {
           maven {
               url "$rootDir/../node_modules/react-native/android"
           }
       }
   }
    maven {
        // Android JSC is installed from npm
        url("$rootDir/../node_modules/jsc-android/dist")
    }

    mavenCentral {
        // We don't want to fetch react-native from Maven Central 
        as there are
        // older versions over there.
        content {
            excludeGroup "com.facebook.react"
        }
    }
    google()
    maven { url 'https://www.jitpack.io' }

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
0

Add this in the allprojects area of your android/buld.gradle file.

def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

allprojects {
    configurations. All {
        resolutionStrategy {
            // Remove this override in 0.65+, as a proper fix is included in react-native itself.
            force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
        }
    }

direct solution from accepted answer worked form me

Android build failures No matching variant of com.facebook.react:react-native:0.71.0-rc.0 was found.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.