gpt4 book ai didi

android - 已完成,错误为 : Gradle task assembleRelease failed with exit code 1

转载 作者:行者123 更新时间:2023-11-30 04:58:52 25 4
gpt4 key购买 nike

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

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

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

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

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

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"
}

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

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'
}

来自 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

最佳答案

试试这个,打开你的 flutter 应用文件夹并转到 android\app\build.gradle 并在 defaultConfig { 上方添加 aaptOptions { cruncherEnabled = false } }。检查下面的示例

aaptOptions { cruncherEnabled = false }
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.test.test"
minSdkVersion 16
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

关于android - 已完成,错误为 : Gradle task assembleRelease failed with exit code 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58597559/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com