2月6日Deadline,Android要上线前夕,Debug包测试通过都正常的情况下,打Release包做发版准备,其中遇到报错,做下小记。 报错如下:
> Task :app:lintVitalAnalyzeRelease FAILED
w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':app:lintVitalAnalyzeRelease' (type 'AndroidLintAnalysisTask').
- Gradle detected a problem with the following location: '/Users/wangzhe/Work/xxxMobile/android/app/build/intermediates/ReactNativeVectorIcons'.
Reason: Task ':app:lintVitalAnalyzeRelease' uses this output of task ':app:copyReactNativeVectorIconFonts' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
Possible solutions:
1. Declare task ':app:copyReactNativeVectorIconFonts' as an input of ':app:lintVitalAnalyzeRelease'.
2. Declare an explicit dependency on ':app:copyReactNativeVectorIconFonts' from ':app:lintVitalAnalyzeRelease' using Task#dependsOn.
3. Declare an explicit dependency on ':app:copyReactNativeVectorIconFonts' from ':app:lintVitalAnalyzeRelease' using Task#mustRunAfter.
Please refer to https://docs.gradle.org/8.0.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
* 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
BUILD FAILED in 2m 20s
解决方案: 在Android/app/build.gradle中添加如下方法
android {
ndkVersion rootProject.ext.ndkVersion
compileSdkVersion rootProject.ext.compileSdkVersion
namespace "com.xxxxxx.mobile"
defaultConfig {
applicationId "com.xxxxxx.mobile"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
// versionName "1.0.1"
versionCode appVersion["versionCode"]
versionName appVersion["version"]
manifestPlaceholders = [
JPUSH_APPKEY: "xxxxxxxxxxxxxxx", //在此替换你的APPKey
JPUSH_CHANNEL: "developer-default" //在此替换你的channel, 暂时填写默认值即可
]
// 添加下方内容即可解决上述问题
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}
}