debug-stripped.ap_' specified for property 'resourceFile' does not exist.处理办法

解决:debug-stripped.ap_' specified for property 'resourceFile' does not exist.

1.错误描述

更新Android Studio到2.0版本后,出现了编译失败的问题,我clean project然后重新编译还是出现抑郁的问题,问题具体描述如下所示:


Error:A problem was found with the configuration of task ':watch:packageOfficialDebug'.
> File 'D:\Code\XTC_VersionCompatible\watch\build\intermediates\res\resources-official-debug-stripped.ap_' specified for property 

'resourceFile' does not exist.

如下图所示: 
这里写图片描述

2. 解决方法

解决方法一

第一步:File—>Settings,打开Settings界面,搜索到Instant Run,如下图所示 
debug-stripped.ap_' specified for property 'resourceFile' does not exist.处理办法_第1张图片
第二步:去掉第一项的勾选,即去掉“Enable Instant Run to hot swap code/resources on deploy (default enabled)”,如下图所示: 
debug-stripped.ap_' specified for property 'resourceFile' does not exist.处理办法_第2张图片
第三步:再重新编译,即可成功。 
debug-stripped.ap_' specified for property 'resourceFile' does not exist.处理办法_第3张图片

解决方法二

关闭Debug模式下的混淆开关,如下所示:

我本地的大致如下,开启了混淆

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

第一步:关闭debug模式下的混淆开关,即将minifyEnabled true改为minifyEnabled false,如下所示:

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

第二步:重新编译即可。

3、参考

上述解决方法参考于:http://stackoverflow.com/questions/36540676/build-intermediates-res-resources-anzhi-debug-stripped-ap-specified-for-prope

Instant Run feature not compatible with proguard on debug mod.

http://tools.android.com/tech-docs/instant-run

Note: Instant Run temporarily disables the Java Code Coverage Library (JaCoCo) and ProGuard. Because Instant Run only works with debug builds, this should not affect your release build.

You can disable Instant Run or disable proguard on debug mod.

(Disabling ProGuard on debug.gradle)

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

你可能感兴趣的:(debug-stripped.ap_' specified for property 'resourceFile' does not exist.处理办法)