以错误完成:Gradle 任务 assembleRelease 失败,退出代码为 1 [英] Finished with error: Gradle task assembleRelease failed with exit code 1

查看:217
本文介绍了以错误完成:Gradle 任务 assembleRelease 失败,退出代码为 1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试构建我的 Flutter 应用程序的发布版本时,会发生此错误.我现在在 StackOverflow 上有很多类似的问题,但我已经尝试了很多方法来解决它,但都没有帮助.

许多人说这是因为其中一个 firebase 插件(我不记得到底是哪个)迁移到 AndroidX 和我的应用程序之间存在冲突,而我的应用程序显然没有.所以我尝试迁移,但是当我按 Refactor > Migrate to AndroidX 时...会发生这种情况:

您需要在模块 build.gradle 中将 compileSdk 设置为至少 28 才能迁移到 AndroidX

但是我有29个compileSdk,所以我正在寻找如何解决这个问题,我被建议去android模块然后迁移.好吧,我猜它有效,但主要问题仍未解决.然后我在 git 上发现了一个问题,人们说要运行 flutter clean,这没有帮助.

这是一些代码:

来自 android/build.gradle 文件的依赖:

依赖项{类路径 'com.android.tools.build:gradle:3.5.1'类路径 'com.google.gms:google-services:4.3.2'类路径org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"}

来自 android/app/build.gradle 文件的依赖:

依赖项{实现org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"实现 'com.google.firebase:firebase-analytics:17.2.1'实现androidx.appcompat:appcompat:1.1.0"实现androidx.core:core:1.2.0-beta01"实现 'com.facebook.android:facebook-android-sdk:5.8.0'testImplementation 'junit:junit:4.12'androidTestImplementation 'androidx.test:runner:1.2.0'androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'}

来自 pubspec.yaml 的依赖:

 http: ^0.12.0+2shared_preferences: ^0.5.3+4url_launcher: ^5.1.3意图:^1.1.0firebase_core:^0.4.0+9firebase_analytics:^5.0.2firebase_auth:^0.14.0+5cloud_firestore:^0.12.9+5google_sign_in: ^4.0.7flutter_facebook_login: ^1.1.1视频播放器:^0.10.2+5

解决方案

您应该在文件 -> 项目结构 -> 模块或依赖项选项卡上检查您的 sdk 和依赖项版本...并检查所有内容是否都是最新的

When I try to build a release version of my flutter app this error occurs. I now that there're many similiar questions on StackOverflow, but I've tried a lot of things to solve it, and none of them helped.

Many people said that this is because of the conflict between one of the firebase plugins (I dont remember wich one exactly) wich migrated to AndroidX and my app which obviously didn't. So I tried to migrate, but when I press Refactor > Migrate to AndroidX... this occurs :

You need to have compileSdk set to at least 28 in your module build.gradle to migrate to AndroidX

But I have 29 compileSdk, so then I was looking how to solve this problem, I was advised to go to android module and then migrate. Well it worked, I guess, but the main problem still wasn't solved. Then I've found an issue on git, where people said to run flutter clean, this didn't help.

Here're some code:

Dependencies from android/build.gradle file:

dependencies {
    classpath 'com.android.tools.build:gradle:3.5.1'
    classpath 'com.google.gms:google-services:4.3.2'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}

Dependencies from android/app/build.gradle file:

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.google.firebase:firebase-analytics:17.2.1'
    implementation "androidx.appcompat:appcompat:1.1.0"
    implementation "androidx.core:core:1.2.0-beta01"
    implementation 'com.facebook.android:facebook-android-sdk:5.8.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

Dependencies from pubspec.yaml:

    http: ^0.12.0+2
    shared_preferences: ^0.5.3+4
    url_launcher: ^5.1.3
    intent: ^1.1.0
    firebase_core: ^0.4.0+9
    firebase_analytics: ^5.0.2
    firebase_auth: ^0.14.0+5
    cloud_firestore: ^0.12.9+5
    google_sign_in: ^4.0.7
    flutter_facebook_login: ^1.1.1
    video_player: ^0.10.2+5

解决方案

you should check your sdk and dependecies version on File -> project structure -> modules or dependencies tab... and check that everything is up to date

这篇关于以错误完成:Gradle 任务 assembleRelease 失败,退出代码为 1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆