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

时间:2016-09-20 10:43:05

标签: android android-studio

我试图使用shrinkResources功能。

我正在使用JackCompilerJAVA_1_8,并编译名为" prod"的风格的发布版本。 这种风格仅用于在使用" dev"时使用更好的编译时间。 minSdk 21的味道。 没有"特定风味"资源。它们都在唯一的公共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.

3 个答案:

答案 0 :(得分:9)

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

minifyEnabled true

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

此处的文档中说明了这一点:https://developer.android.com/studio/build/shrink-code.html#shrink-resources

答案 1 :(得分:0)

在您的gradle文件集中设置'shrinkResources false'

答案 2 :(得分:-1)

你将你的android工作室更新到2.2吗?如果那个降级了  classpath'com.android.tools.build:grad:2.2.0' 到classpath'com.android.tools.build:grad:2.1.3' 但放弃即时运行

相关问题