\\build\\intermediates\\res\\resources-anzhi-debug-stripped.ap_' specified for property 'resourceFile' does not exist

一笑奈何 提交于 2019-11-27 07:22:36

Having same issue ! So instant run is not compatible with shrinkResources

1) if use Android Studio 2.2

shrinkResources false

buildTypes {
    release {
        signingConfig signingConfigs.release
        minifyEnabled false
        shrinkResources false
        zipAlignEnabled true
        debuggable false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

2) if use Android Studio 2.0

  • open setting

  • now run your project

Bartek Lipinski

If you're experiencing this issue when building a release build, keep in mind that Android Plugin for Gradle 2.2.0 (and above) seems to have a bug with shrinkResources.

Downgrade gradle to 2.1.3 for a temporary solution:

classpath 'com.android.tools.build:gradle:2.1.3'

EDIT:

I reported this issue to wojtek.kalicinski (Android Developer Advocate at Google).

As it turns out, shrinkResources works only if there is minifyEnabled set to true. 2.1.3 version of Android Plugin was just ignoring the issue (and failing to shrinkResources silently). 2.2.0+ is letting you know that there is something wrong with an error (which itself isn't really informative). Google might introduce a better error message for this kind of scenarios in the future.

Here's the twitter conversation:

Roc Boronat

Probably you are shrinking the resources while avoiding minifying:

minifyEnabled false
shrinkResources true

If you want to shrink the resources, you have to enable minifying:

minifyEnabled true
shrinkResources true

Older versions of Build Tools were ignoring this issue, but it started throwing compilation issues on Build Tools 2.2.3

More information here: https://developer.android.com/studio/build/shrink-code.html#shrink-resources

young

Set shrinkResources to false. It worked for me

buildTypes {
    release {
        minifyEnabled false
        shrinkResources false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        debuggable false
        jniDebuggable false
        zipAlignEnabled true
    }
}

Found an answer, just disable instarun and it should work. It worked for me.

  1. We could use both Instant Run and shrinkResources at the same time;
  2. Please be noted that we CANNOT use Jack and shrinkResources at the same time (the same to ProGuard, minifyEnabled)

As suggested by @Bartek-lipinski's post, I have confirmed on my own project that downgrading Gradle plugin to v2.1.3 will solve this problem of getting "InvalidUserDataException: File specified for property does not exist."

I have filed a bug with the Android tools bugtracker website, please upvote to get some more visibility on the problem.

In my project, because I added in the gradle shrinkResources, remove the Ok.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!