无法发布此 Flutter 应用中 AndroidX 不兼容的 appBundle 原因

Can not release appBundle cause of AndroidX incompatibilities in this Flutter app

我想用 'flutter build appbundle' 发布 appBundle,但我遇到了这个错误。该项目已经迁移到 AndroidX。没有用到第三方库

compileSdkVersion: 28
targetSdkVersion: 28
minSdkVersion: 16
buildTypes {
        release {
            signingConfig signingConfigs.release

            minifyEnabled true
            useProguard true

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

            dependencies {
                implementation 'com.android.support:support-fragment:28.0.0'
            }
        }
    }

依赖关系:

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

在gradle.properties

android.useAndroidX=true
android.enableJetifier=true

在文件 android/gradle/wrapper/gradle-wrapper.properties 中检查 distributionUrl 必须是:

distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip

在文件 android/build.gradle 上,更改:

dependencies {
  classpath 'com.android.tools.build:gradle:3.2.1'

至:

dependencies {
  classpath 'com.android.tools.build:gradle:3.3.0'

在文件 android/app/build.gradle 上,替换行:

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

至:

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

我已经解决了我的问题:
应该删除实现 support-fragment 的依赖项,因为我遵循了这个答案:https://github.com/flutter/flutter/issues/28979#issuecomment-476426976

将 minifyEnabled 更改为 false

然后我用了:

flutter clean
flutter packages get
flutter build appbundle

修复已在测试版频道上线,发布版本为 v1.7.8+hotfix.2