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

    }

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容