我的Android进阶之旅------>解决Error: specified for property 'mergedManifest' does not exist....

错误描述

刚运行从Github上面下载而来的代码时,爆了如下所示的bug,错误描述如下所示:

Error:A problem was found with the configuration of task ':app:generateDebugInstantRunAppInfo'.
> File 'F:\Multi-Thread Download\MultiThreadDownload\app\build\intermediates\bundles\debug\instant-run\AndroidManifest.xml' specified for property 'mergedManifest' does not exist.

如下图所示:
我的Android进阶之旅------>解决Error: specified for property 'mergedManifest' does not exist...._第1张图片

解决方法

在stackoverflow网站上面搜索到了相关方面的解决方法,地址如下:
http://stackoverflow.com/questions/24536065/manifest-mergeing-android-studio-0-8-1-upgrade-build-error-property-manifest

我的Android进阶之旅------>解决Error: specified for property 'mergedManifest' does not exist...._第2张图片

按照上面的修改,修改之前的gradle文件内容如下:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.aspsine.multithreaddownload"
        minSdkVersion 21
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    packagingOptions {
        exclude 'META-INF/services/javax.annotation.processing.Processor'
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:recyclerview-v7:23.3.0'
    compile 'com.android.support:cardview-v7:23.3.0'
    compile 'com.jakewharton:butterknife:7.0.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile project(':library')
}

然后增加上面所示的几行代码:

defaultConfig {
        manifestPlaceholders = [ activityLabel:"defaultName"]
    }
    productFlavors {
        free {
        }
        pro {
            manifestPlaceholders = [ activityLabel:"proName" ]
        }
    }

增加后的部分截图如下所示:
我的Android进阶之旅------>解决Error: specified for property 'mergedManifest' does not exist...._第3张图片

完整的gradle文件内容如下:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"


    defaultConfig {
        applicationId "com.aspsine.multithreaddownload"
        minSdkVersion 21
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        manifestPlaceholders = [ activityLabel:"defaultName"]
    }

    productFlavors {
        free {
        }
        pro {
            manifestPlaceholders = [ activityLabel:"proName" ]
        }
    }

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

    lintOptions {
        disable 'InvalidPackage'
    }

    packagingOptions {
        exclude 'META-INF/services/javax.annotation.processing.Processor'
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:recyclerview-v7:23.3.0'
    compile 'com.android.support:cardview-v7:23.3.0'
    compile 'com.jakewharton:butterknife:7.0.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile project(':library')
}

修改完成后,同步一下代码,重新编译即可成功。如下图所示:
我的Android进阶之旅------>解决Error: specified for property 'mergedManifest' does not exist...._第4张图片

作者:欧阳鹏 欢迎转载,与人分享是进步的源泉!
转载请保留原文地址:http://blog.csdn.net/ouyang_peng

这里写图片描述

你可能感兴趣的:(我的Android进阶之旅------>解决Error: specified for property 'mergedManifest' does not exist....)