我在使用 Flutter 编译版本时遇到此错误
FAILURE: Build failed with an exception.
[ +1 ms] * What went wrong:
[ ] Execution failed for task ':flutter_inappwebview:minifyReleaseWithR8'.
[ ] > java.util.zip.ZipException: zip END header not found
但是编译调试 apk 工作得很好。我已经尝试了所有可能的解决方案,删除和重新安装 gradle 都不起作用。
Flutter 修复建议如下:
[!] 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
似乎 R8 可能会导致问题,但当我尝试使用 --no-shrink 进行编译时,它完全被忽略,它仍然尝试使用 R8 进行缩小。
任何建议将不胜感激
我尝试禁用 minify 以便在不收缩的情况下进行编译,但它仍然使用 R8 进行 minify
要解决软件包问题,请按照以下步骤操作:
打开您的
pubspec.yaml
文件。
在
dev_dependencies
下添加以下行:
dependency_overrides:
flutter_inappwebview_android:
git:
url: https://github.com/holzgeist/flutter_inappwebview
path: flutter_inappwebview_android
ref: d89b1d32638b49dfc58c4b7c84153be0c269d057
更多详情,您可以参考相关的GitHub问题这里。