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 版本私信我?

  • 5
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值