当前位置:   article > 正文

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

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

解决方法 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
        }
    }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

其他react-native 版本私信我?

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/310966
推荐阅读
相关标签
  

闽ICP备14008679号