简体   繁体   English

flutter 发布 apk 错误:任务 ':app:lintVitalRelease' 执行失败

[英]flutter release apk error :Execution failed for task ':app:lintVitalRelease'

I can not release my app any more.我不能再发布我的应用程序了。 I'm using AndroidStudio 4.0 and flutter sdk version 1.17.5.我正在使用 AndroidStudio 4.0 和 flutter sdk 版本 1.17.5。 I had been released my app two times last month but now I really don't know whats the reason of error.上个月我两次发布了我的应用程序,但现在我真的不知道错误的原因是什么。 when I type flutter build apk --release in terminal then these errors occure:当我在终端中键入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

If error is about profile/libs.jar , do following in terminal:如果错误是关于profile/libs.jar ,请在终端中执行以下操作:

flutter build apk --profile

and then接着

flutter build apk --release  

solves the issue.解决了这个问题。

and if error is about debug/libs.jar如果错误是关于debug/libs.jar

flutter build apk --debug

and then接着

flutter build apk --release  

will solve the problem会解决问题

For me worked this way only:对我来说,仅以这种方式工作:

First: flutter build apk --debug
Then: flutter build apk --profile
In the end: flutter build apk --release

I have upgraded my gradle build tools 3.5.0 -> 4.0.1.我已经升级了我的 gradle 构建工具 3.5.0 -> 4.0.1。 After that I am not was not able to make release apk.之后我不是无法发布 apk。 Looks like upgrading gradle build tools broke some lints.看起来升级 gradle 构建工具破坏了一些 lints。

Below solution worked for me以下解决方案对我有用

Go in android folder->app->open build.gradle fine Search for lintOptions and add checkReleaseBuilds false example: Go 在 android 文件夹->应用程序->打开 build.gradle 细搜索 lintOptions 并添加checkReleaseBuilds 错误示例:

lintOptions {
  disable 'InvalidPackage'
  checkReleaseBuilds false //Insert this line
}

Worked for me为我工作

1- flutter build apk --debug

2- flutter build apk --profile
3-  flutter build apk --release

In my case, I had to add the flavor name as well following this sequence:就我而言,我必须按照以下顺序添加风味名称:

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>

I know that the problem may have already been solved, however I did not like the way the proposed solutions propose to solve the problem.我知道问题可能已经解决了,但是我不喜欢建议的解决方案提出的解决问题的方式。 In my view, the following is a more correct solution:在我看来,以下是更正确的解决方案:

Make sure everything here is correct: https://flutter.dev/docs/deployment/android#shrinking-your-code-with-r8确保这里的一切都是正确的: https://flutter.dev/docs/deployment/android#shrinking-your-code-with-r8

Be sure to check each parameter and version used.请务必检查使用的每个参数和版本。 This works in all my apps and without gambling.这适用于我的所有应用程序,无需赌博。

Check if in android\app\build.gradle is as below:检查android\app\build.gradle中是否如下:

buildTypes {
       release {
           signingConfig signingConfigs.release
           minifyEnabled true
           shrinkResources true
           useProguard true
           proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
       }
   }

Check if in android\build.gradle is as below:检查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'
    }
}

Check if in android\gradle.properties is as below:检查android\gradle.properties中是否如下:

org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true

Check if in android\gradle\wrapper\gradle-wrapper.properties is as below:检查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

Now you can run the commands: flutter run apk or flutter run appbundle should work.现在您可以运行命令: flutter run apkflutter run appbundle应该可以工作。

Follow these steps if anyone encounter same issue如果有人遇到同样的问题,请按照以下步骤操作

  1. Go to Terminal write following lines Go 到终端写入以下行
  2. flutter clean
  3. flutter pub get
  4. flutter build apk --profile
  5. flutter build apk --release

hope it will solve the issue希望它能解决问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 出现错误:任务 ':app:lintVitalRelease' 执行失败 - Getting An Error : Execution failed for task ':app:lintVitalRelease' 任务 ':app:lintVitalRelease' flutter 文件选择器执行失败 - Execution failed for task ':app:lintVitalRelease' flutter file picker 错误:任务&#39;:app:lintVitalRelease&#39;的执行失败任何人都可以解决它? - Error: Execution failed for task ':app: lintVitalRelease' any one can solve it? 如何修复任务':app:lintVitalRelease'的执行失败 - how to fix Execution failed for task ':app:lintVitalRelease' Android:任务“:app:lintVitalRelease”执行失败 - Android:Execution failed for task ':app:lintVitalRelease' Flutter 构建apk报错:Execution failed for task ':app:compileFlutterBuildRelease' - Flutter build apk error: Execution failed for task ':app:compileFlutterBuildRelease' 任务 ':app:lintVitalRelease' 执行失败 - ':video_player_android:debugUnitTestRuntimeClasspath' - Execution failed for task ':app:lintVitalRelease' - ':video_player_android:debugUnitTestRuntimeClasspath' 错误:任务&#39;:app:transformClassesWithJarMergingForRelease&#39;的执行失败。 与释放 - Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'. with release 颤振构建apk给出错误“任务&#39;:app:mergeReleaseResources&#39;的执行失败。” 关于詹金斯 - flutter build apk giving error "Execution failed for task ':app:mergeReleaseResources'." on jenkins 任务 ':app:compileFlutterBuildRelease' 执行失败。 在 Flutter 创建 APK - Execution failed for task ':app:compileFlutterBuildRelease'. on Flutter creating APK
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM