zoukankan      html  css  js  c++  java
  • packageOfficialDebug和resourceFile does not exist.

    Android Studio运行时候报packageOfficialDebug错误

    报错信息为

    Error:A problem was found with the configuration of task':watch:packageOfficialDebug'.
    File '...uildintermediates es esources-official-debug-stripped.ap_' specified for property 'resourceFile' does not exist.

    解决方法一:

    这个大多数原因是开启了混淆造成的,关闭Debug模式下的混淆开关后重新编译即可,代码如下:

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

    minifyEnabled即以前的runProguard,用来控制是否混淆。

    shrinkResources为true时自动去掉多余资源。

    注:Gradle2.0以上的版本minifyEnabled字段为true时已经包含了shrinkResources,在代码优化时会自动去掉多余资源,所以在打正式包时也不需要设置shrinkResources字段。

    解决方法二:

    Android Studio2.0以上有了Instant Run功能,很多情况下运行报错都跟Instant Run有关
    进入File --> Setting(Ctrl+Alt+S)找到InstantRun功能,把InstantRun功能关闭





  • 相关阅读:
    python调用ggsci.exe程序
    confluence安装
    nginx优化
    ELKstack搭建
    zabbix 安装
    python requests
    小程序消息推送
    shell
    rar 解压
    ubuntu 安装部分设置U盘启动系统安装盘操作
  • 原文地址:https://www.cnblogs.com/jeffen/p/6867609.html
Copyright © 2011-2022 走看看