颤振发布apk错误:任务':app:lintVitalRelease'执行失败
Posted
技术标签:
【中文标题】颤振发布apk错误:任务\':app:lintVitalRelease\'执行失败【英文标题】:flutter release apk error :Execution failed for task ':app:lintVitalRelease'颤振发布apk错误:任务':app:lintVitalRelease'执行失败 【发布时间】:2020-10-24 11:20:22 【问题描述】:我不能再发布我的应用程序了。
我正在使用 androidStudio 4.0 和颤振 sdk 版本 1.17.5 。
上个月我两次发布了我的应用程序,但现在我真的不知道错误的原因是什么。
当我在终端中输入flutter build apk --release
时,就会出现这些错误:
Running Gradle task 'assembleRelease'...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:profileRuntimeClasspath'.
> Failed to transform libs.jar to match attributes artifactType=processed-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime.
> Execution failed for JetifyTransform: ....\build\app\intermediates\flutter\profile\libs.jar.
> Failed to transform '....\build\app\intermediates\flutter\profile\libs.jar' using Jetifier. Reason: FileNotFoundException, message: ....\build\app\intermediates\flutter\profile\libs.jar (The system cannot find the path specified). (Run with --stacktrace for more details.)
Please file a bug at http://issuetracker.google.com/issues/new?component=460323.
* 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 42s
Running Gradle task 'assembleRelease'... 43.4s
Gradle task assembleRelease failed with exit code 1
【问题讨论】:
像这样详细运行 > flutter run --release -v 欺骗***.com/questions/62394034/… 查看此链接了解详细说明:***.com/questions/62394034/… 【参考方案1】:如果错误是关于 profile/libs.jar
,请在终端中执行以下操作:
flutter build apk --profile
然后
flutter build apk --release
解决问题。
如果错误是关于debug/libs.jar
flutter build apk --debug
然后
flutter build apk --release
解决问题
【讨论】:
这是我运行flutter build apk --profile
后得到的:Gradle build failed to produce an .apk file. It's likely that this file was generated under ~/dev/flutter/discover_rudy/build, but the tool couldn't find it
【参考方案2】:
对我来说,只用这种方式工作:
First: flutter build apk --debug
Then: flutter build apk --profile
In the end: flutter build apk --release
【讨论】:
虽然@Zahra 答案领先,但这个答案是唯一对我有帮助的答案。确保以相同的顺序执行这些步骤。【参考方案3】:我已经升级了我的 gradle 构建工具 3.5.0 -> 4.0.1。 之后我不是无法发布 apk。 升级 gradle 构建工具似乎破坏了一些 lints。
以下解决方案对我有用
进入android文件夹->app->打开build.gradle就好了 搜索 lintOptions 并添加 checkReleaseBuilds false 示例:
lintOptions
disable 'InvalidPackage'
checkReleaseBuilds false //Insert this line
【讨论】:
确保将 lintOptions 移动到 Gradle 文件的 android 部分:developer.android.com/reference/tools/gradle-api/4.1/com/…,但似乎不推荐使用这种方法:***.com/questions/24098494/…【参考方案4】:就我而言,我还必须按照以下顺序添加风味名称:
flutter build apk --debug --flavor <dev-flavor>
flutter build apk --debug --flavor <prod-flavor>
flutter build apk --profile --flavor <dev-flavor>
flutter build apk --profile --flavor <prod-flavor>
flutter build apk --release --flavor <dev-flavor>
flutter build apk --release --flavor <prod-flavor>
【讨论】:
【参考方案5】:为我工作
1- flutter build apk --debug
2- flutter build apk --profile
3- flutter build apk --release
【讨论】:
您刚刚从@wahid anvary 复制粘贴。下次在您的答案中添加其他信息。【参考方案6】:我知道问题可能已经解决,但是我不喜欢建议的解决方案提出的解决问题的方式。在我看来,以下是更正确的解决方案:
确保这里的一切都是正确的: https://flutter.dev/docs/deployment/android#shrinking-your-code-with-r8
请务必检查使用的每个参数和版本。这适用于我的所有应用程序,并且没有赌博。
检查android\app\build.gradle
中是否如下:
buildTypes
release
signingConfig signingConfigs.release
minifyEnabled true
shrinkResources true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
检查android\build.gradle
中是否如下:
buildscript
repositories
google()
jcenter()
dependencies
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.google.gms:google-services:4.3.4'
检查android\gradle.properties
中是否如下:
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
检查android\gradle\wrapper\gradle-wrapper.properties
中是否如下:
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
现在您可以运行以下命令:flutter run apk
或 flutter run appbundle
应该可以工作。
【讨论】:
【参考方案7】:如果有人遇到同样的问题,请按照这些步骤操作
-
转到终端写入以下行
flutter clean
flutter pub get
flutter build apk --profile
flutter build apk --release
希望能解决问题
【讨论】:
以上是关于颤振发布apk错误:任务':app:lintVitalRelease'执行失败的主要内容,如果未能解决你的问题,请参考以下文章
颤振应用程序发布显示错误任务':app:validateSigningRelease'执行失败
颤振应用程序发布显示错误任务':app:validateSigningRelease'执行失败