前两天还好好的,今天突然就报错:
* What went wrong:
Execution failed for task ':@react-native-community_async-storage:generateReleaseRFile'.
> Could not resolve all files for configuration ':@react-native-community_async-storage:releaseCompileClasspath'.
> Failed to transform react-native-0.71.0-rc.0-release.aar (com.facebook.react:react-native:0.71.0-rc.0) to match attributes {artifactType=android-symbol-with-package-name, com.android.build.api.attributes.BuildTypeAttr=release, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-api}.
> Could not find react-native-0.71.0-rc.0-release.aar (com.facebook.react:react-native:0.71.0-rc.0).
Searched in the following locations:
https://maven.aliyun.com/repository/jcenter/com/facebook/react/react-native/0.71.0-rc.0/react-native-0.71.0-rc.0-release.aar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
方法一:android/app/build.gradle 文件react-native:+ 指定版本,我用的是0.64.0
implementation "com.facebook.react:react-native:0.64.0" // 换成你自己的版本
如果方法一还是报错,就用方法二:android/build.gradle 添加如下代码
allprojects {
repositories {
...
exclusiveContent {
filter {
includeGroup "com.facebook.react"
}
forRepository {
maven {
url "$rootDir/../node_modules/react-native/android" // 强制使用node_modules下的react-native/android 解析
}
}
}
}
}
如果哪天官网修复了这个bug,可以将上述修改撤回