无法使用 shrinkResources:为属性'resourceFile'指定的 res/resources-prod-release-stripped.ap_' 不存在



我正在尝试使用shrinkResources功能。

我正在使用JackCompilerJAVA_1_8,并编译名为"prod"的风味的发布版本。这种风格仅用于在使用minSdk 21的"dev"风格时利用更好的编译时间。没有"特定口味"的资源。它们都在唯一的公共res文件夹中。

当运行编译时,我得到以下错误:

:app:packageProdRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong: A problem was found with the configuration of task ':app:packageProdRelease'.
File '/app/build/intermediates/res/resources-prod-release-stripped.ap_' specified for property 'resourceFile' does not exist.

为了使shrinkResources工作,您还必须设置

minifyEnabled true

资源收缩需要删除未使用的代码,否则会出现错误。

在文档中有说明:https://developer.android.com/studio/build/shrink-code.html#shrink-resources

在gradle文件中设置'shrinkResources false'

你要更新你的android studio到2.2吗?如果它退化了类路径"com.android.tools.build: gradle: 2.2.0"到类路径'com.android.tools.build:gradle:2.1.3'但放弃瞬间奔跑

相关内容