android - 在颤振中构建不成功
问题描述
当我尝试 flutter build apk --release 时,出现以下错误
FAILURE: Build failed with an exception.
* Where:
Build file
'/Users/flutter/Documents/project_name/android/
build.gradle' line: 27
* 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
BUILD FAILED in 33s
当我为 ios 构建时,我得到了输出。但尺寸非常大,大约 400 mb。
如何解决所有这些问题......
解决方案
不确定是什么问题,但根据错误日志,您必须从代码中删除所有未使用的资源,然后您必须在 gradle 中进行设置。
android {
...
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}}
此外,如果您将删除未使用的资源,它将减少 iOS 构建的大小。
快乐的编码...
推荐阅读
- java - 在速度弹簧的电子邮件正文中包含一个文件
- node.js - 在我的 node.js 服务中获取错误为“错误:发送后无法设置标头”
- codeigniter - 如何在codeigniter中获取uri的值?
- ruby-on-rails - LoadError:库版本不兼容 - /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/nokogiri-1.8.2/lib/nokogiri/nokogiri.so
- css - CSS vw但包含块宽度的百分比?
- sprite-kit - isPaused 在 SKNode() 中无法正常工作
- statistics - Power BI 小计行
- powershell - 将多个参数传递给高级安装程序中的 Powershell 内联脚本
- android - 什么是非 SDK 接口
- windows - Windows 上的 Ansible:成为 / become_user 权限/所有者问题