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 0.71-rc.0编译错误
本文介绍了解决React Native 0.71-rc.0版本中出现的编译错误的方法。由于官方发布的版本存在配置失误,导致使用该版本进行Android应用开发时出现问题。文章提供了适用于React Native 0.63版本的解决方案,并提及了针对其他版本的获取途径。
706

被折叠的 条评论
为什么被折叠?



