【问题标题】:Flutter app Android studio 3.2.1, build failFlutter app Android studio 3.2.1,构建失败
【发布时间】:2019-03-31 21:14:37
【问题描述】:

我将 Android Studio 更新到 3.2.1 并在 Mac 的终端中运行“flutter build apk”,它显示以下错误。在更新 Android Studio 之前,我能够成功构建 apk。

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> Job failed, see logs for details

这里是我的 proguard-rules.pro

#Flutter Wrapper
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.**  { *; }
-keep class io.flutter.util.**  { *; }
-keep class io.flutter.view.**  { *; }
-keep class io.flutter.**  { *; }
-keep class io.flutter.plugins.**  { *; }
-keep class com.google.firebase.** { *; }

【问题讨论】:

标签: build flutter apk proguard


【解决方案1】:

这解决了我的问题,

 #Flutter Wrapper
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.**  { *; }
-keep class io.flutter.util.**  { *; }
-keep class io.flutter.view.**  { *; }
-keep class io.flutter.**  { *; }
-keep class io.flutter.plugins.**  { *; }
-dontwarn android.**

在这里查看解释: https://github.com/flutter/flutter/issues/40218#issuecomment-531047713

【讨论】:

    【解决方案2】:

    转到 android/app/build.gradle 并尝试 minifyEnabled false 它应该可以工作

    【讨论】:

      猜你喜欢
      • 2021-11-24
      • 2019-06-19
      • 2019-05-16
      • 2021-04-25
      • 1970-01-01
      • 1970-01-01
      • 2019-06-07
      • 2019-05-17
      相关资源
      最近更新 更多