Home > Web Front-end > JS Tutorial > React Native 0.71.0-rc.0 Android Build Failures: How Can I Fix Them?

React Native 0.71.0-rc.0 Android Build Failures: How Can I Fix Them?

Patricia Arquette
Release: 2024-12-06 01:35:11
Original
166 people have browsed it

React Native 0.71.0-rc.0 Android Build Failures: How Can I Fix Them?

Android Build Failures in React Native after Release of Version 0.71.0-rc.0

Recent Android build failures in React Native have been attributed to the publication of React Native version 0.71.0-rc.0. Even without code changes, users have encountered various error messages during the build process.

Method 1

Modify your android/build.gradle file by implementing the following fix:

buildscript {
    // ...
}


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

This fix introduces an exclusive resolution rule that compels the use of the React Native Android library within the node_modules directory.

Method 2

If Method 1 is incompatible with your gradle version, add the following to your android/build.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())


buildscript {
     // ...
}
    
    
allprojects {
    configurations.all {
          resolutionStrategy {
            force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
          }
    }
    // ...  
}
Copy after login

Refer to "Fix and updates on Android build failures happening since Nov 4th 2022 #35210" for details on this adjustment.

The above is the detailed content of React Native 0.71.0-rc.0 Android Build Failures: How Can I Fix Them?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template