react-native - ./gradlew clean build 上的 RNC Slider lint 失败,并在应用启动时发布 apk 崩溃
问题描述
在组装发布之前,我正在尝试进行干净的构建,但它会引发错误并使任务失败。当我生成发布 apk(成功生成)后,在我的 LG G4 手机(也尝试过三星 Galaxy J3)上安装它后,它崩溃并且无法启动。
react-native run-android
我的应用程序在我的手机上成功运行。
在组装发布版本之前,我输入了
cd android
./gradlew clean
./gradlew buildcache
./gradlew clean build
最后一个命令总是给出错误。
添加后
android {
lintOptions {
abortOnError false
}
}
正如错误所说,到 RNC Slider 的 build.gradle 文件,./gradlew clean build
成功完成其任务。但是在生成和安装发布 apk 后我仍然无法打开应用程序。
./gradlew clean build
错误:
...
> Task :@react-native-community_slider:lint FAILED
Ran lint on variant release: 3 issues found
Ran lint on variant debug: 3 issues found
Wrote HTML report to file:///D:/React/Pure%20RN/dassist/node_modules/@react-native-community/slider/android/build/reports/lint-results.html
Wrote XML report to file:///D:/React/Pure%20RN/dassist/node_modules/@react-native-community/slider/android/build/reports/lint-results.xml
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':@react-native-community_slider: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
}
}
...
Errors found:
D:\React\Pure RN\dassist\node_modules\@react-native-community\slider\android\src\main\java\com\reactnativecommunity\slider\ReactSliderManager.java:68: Error: Value must be ? 0 (was -2) [Range]
ViewGroup.LayoutParams.WRAP_CONTENT,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* 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.
* Get more help at https://help.gradle.org
BU¦LD FAILED in 35s
163 actionable tasks: 154 executed, 9 up-to-date
这是输出日志中提到的 xml 报告文件(不包括警告)的一部分:
<issues format="5" by="lint 3.3.1">
<issue
id="Range"
severity="Error"
message="Value must be ≥ 0 (was -2)"
category="Correctness"
priority="6"
summary="Outside Range"
explanation="Some parameters are required to in a particular numerical range; this check makes sure that arguments passed fall within the range. For arrays, Strings and collections this refers to the size or length."
errorLine1=" ViewGroup.LayoutParams.WRAP_CONTENT,"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="D:\React\Pure RN\dassist\node_modules\@react-native-community\slider\android\src\main\java\com\reactnativecommunity\slider\ReactSliderManager.java"
line="68"
column="13"/>
</issue>
</issues>
解决方案
推荐阅读
- java - 使用 JNLP 启动的 Java 应用程序中的安全漏洞
- angular - 带有嵌套模块和嵌套重定向的角度路由
- python - 只执行一个 IF 直到值改变
- syntax-error - How to write consecutive case statements?
- c - 如何使用 GTK4 将图像添加到按钮?
- asmx - 将 .net framework 4.5 或更高版本添加到我的 vs 2017
- r - R–将函数应用于列表中的特定列
- python - 在 Django 中使用 LoginView 显示错误
- c++ - 未解析的外部符号,但仅带有参数
- redisgraph - RedisGraph 中对日期时间数据类型的支持