react-native - 已弃用的 Gradle 功能不兼容
问题描述
运行时出现此错误react-native run-android
日志:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Android Gradle Plugin Version - 3.6.3
Gradle Version- 6.0.1
解决方案
- 更新以下文件:
gradle-wrapper.properties
distributionUrl=https://services.gradle.org/distributions/gradle-6.0.1-all.zip
android/app/build.gradle
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
multiDexEnabled true //add this
}
- 更新所有第三方依赖项
如果错误仍然存在,请运行以下命令:
cd android && ./gradlew clean && ./gradlew :app:bundleRelease
如果它仍然存在,试试这个:
npm install --save-dev jetifier npx jetify npx react-native run-android
推荐阅读
- php - 从多个按钮php获取提交按钮值
- xamarin.forms - 尝试清除 xamarin ios 中的缓存时出现 UnauthorizedAccessException
- c# - Azure 应用服务 - 无法加载文件或程序集“System.Net.Http,版本=4.2.0.0,文化=中性,PublicKeyToken=b03f5f7f11d50a3a”
- amazon-web-services - AWS S3 GetBucketLifecycleConfiguration 访问被拒绝
- android - 按下后启动 Activity
- matlab - 有没有办法对这个 Matlab/Octave 代码进行矢量化
- php - PHP如何获取函数参数,当函数作为参数传递时
- firebase - 检查 Firestore 中的新条目 - 本地存储
- azure - 如何使用 VSTS 对 Docker 进行身份验证?
- sql - 如何在sql中比较和插入不同的表?