解决Could not find manifest-merger.jar

AndroidStudio在编译时报错:

Could not find manifest-merger.jar (com.android.tools.build:manifest-merger:26.1.2).
Searched in the following locations:
    https://jcenter.bintray.com/com/android/tools/build/manifest-merger/26.1.2/manifest-merger-26.1.2.jar

在jcenter中找不到manifest-merger.jar包,看了一下我的根build.gradle文件,发现jcenter()在google()前面,它在jcenter中找不到manifest-merger.jar包就不会再去google中寻找了:

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}

allprojects {
    repositories {
        jcenter()
        flatDir {
            dirs 'libs'
        }
        google()
    }
}

然后将google和jcenter换下位置,让它去google中下载manifest-merger.jar包,就可以编译通过了:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        flatDir {
            dirs 'libs'
        }
    }
}
    原文作者:Drc15H
    原文地址: https://www.jianshu.com/p/d719984b0ac8
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞