react-native,“abortOnError false”,但由于 lint 错误,android 构建失败
Posted
技术标签:
【中文标题】react-native,“abortOnError false”,但由于 lint 错误,android 构建失败【英文标题】:react-native, "abortOnError false" and yet the android build fails due to lint error 【发布时间】:2021-02-12 00:48:36 【问题描述】:在我的 react-native 应用程序中,为 android 构建我得到 lint 错误失败。我想忽略它,但添加推荐的脚本并不能解决问题,而且构建仍然失败
./gradlew build
* What went wrong:
Execution failed for task ':react-native-maps:lint'.
> Lint found errors in the project; aborting build.
Fix the issues identified by lint, or add the following to your build script to proceed with errors:
...
android
lintOptions
abortOnError false
...
并已将推荐添加到app/build.gradle
android
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions ...
defaultConfig ...
splits ...
signingConfigs ...
buildTypes ...
packagingOptions ...
lintOptions
abortOnError false
【问题讨论】:
这些设置不会影响第三方项目 【参考方案1】:你应该修改 android/build.gradle 而不是 android/app/build.gradle 因为react-native-maps
是第三方项目。
allprojects
// append here
afterEvaluate
if (getPlugins().hasPlugin('android') ||
getPlugins().hasPlugin('android-library'))
configure(android.lintOptions)
abortOnError false
checkReleaseBuilds false
然后运行 ./gradlew clean
以在另一个构建之前配置每个项目。
【讨论】:
以上是关于react-native,“abortOnError false”,但由于 lint 错误,android 构建失败的主要内容,如果未能解决你的问题,请参考以下文章