在flutter run 运行程序是出现如下错误,当时蛋疼的一B,查了一下原来是设置了删除无用资源导致的。
* Error running Gradle:
ProcessException: Process "/Users/Na/Desktop/dd/FlutterProject/flutter_http/android/gradlew" exited abnormally:
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/NN/Desktop/NN/FlutterProject/flutter_http/android/build.gradle' line: 34
* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
> Removing unused resources requires unused code shrinking to be turned on. See http://d.android.com/r/tools/shrink-resources.html for more information.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
解决办法删除以下两项再次运行解决上述问题。
zipAlignEnabled true//内存对齐 // 移除无用的resource文件 shrinkResources true

本文详细描述了在使用Flutter进行应用开发时,遇到的关于资源压缩配置导致的运行错误。具体表现为在运行程序时,Gradle构建失败,提示移除无用资源需开启代码瘦身。文章提供了具体的错误信息及解决步骤,包括禁用内存对齐和移除无用的resource文件,以帮助开发者快速定位并解决问题。
1801

被折叠的 条评论
为什么被折叠?



