22年11月4日后reactnative 安卓编译出错的问题 、Failed to transform react-native-0.71.0-rc.0-debug.aar

Failed to transform react-native-0.71.0-rc.0-debug.aar

原因: 官方发布0.71-rc.0版本时候手误,导致0.71以下版本编译安卓可能都会遇到问题

错误内容

			Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
			FAILURE: Build failed with an exception.
	* What went wrong:
	A problem occurred configuring root project 'My Project'.
	Could not determine the dependencies of null.
	Could not resolve all task dependencies for configuration ':classpath'.
	    > Could not resolve com.facebook.react:react-native:+.
	      Required by:
	          project :
	    > No matching variant of com.facebook.react:react-native:0.71.0-rc.0 was found. 
	      The consumer was configured to find a runtime of a library compatible with Java 11, 
	      packaged as a jar, and its dependencies declared externally, as well 
	      as attribute 'org.gradle.plugin.api-version' with value '7.3.3' but

解决方法 react-native 0.63

android/buld.gradle 文件添加

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.66, as a proper fix is included in react-native itself.
            force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
        }
    }

其他react-native 版本私信我?

你可能感兴趣的:(react-native,android,react,native,react.js)