Flutter报错:The shrinker may have failed to optimize the Java bytecode

译:收缩器可能未能优化Java字节码。

[!] The shrinker may have failed to optimize the Java bytecode.

    To disable the shrinker, pass the `--no-shrink` flag to this command.

    To learn more, see: https://developer.android.com/studio/build/shrink-code

==========================================================================

解决:

https://stackoverflow.com/questions/60745249/flutter-the-shrinker-may-have-failed-to-optimize-the-java-bytecode/62932201

Here is the process of how to fix this.

1: Change some codes in located to thisandroid/app/build.gradle

buildTypes {

      debug {

        minifyEnabled true

        // TODO: Add your own signing config for the release build.

        // Signing with the debug keys for now, so `flutter run --release` works.

        signingConfig signingConfigs.debug

    }

}

2: Change minSdkVersion 16 to 21

  defaultConfig {

        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).

        applicationId "com.company.appname"

        minSdkVersion 21

        targetSdkVersion 29

        versionCode flutterVersionCode.toInteger()

        versionName flutterVersionName

    }

你可能感兴趣的:(Flutter报错:The shrinker may have failed to optimize the Java bytecode)