问题描述
我在Bitbucket CI服务器上构建失败:
I have failing build on a Bitbucket CI server:
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find aapt2-proto.jar (com.android.tools.build:aapt2-proto:0.3.1).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/aapt2-proto/0.3.1/aapt2-proto-0.3.1.jar
我搜索了类似的问题,表明缺少Google Maven存储库,但我没有丢失它.顶级构建文件:
I searched similar questions that suggested the Google Maven repository is missing, but I am not missing it. Top level build file:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin"
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
我的应用程序级别构建文件:
And my app level build file:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
google()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.26.1'
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
google()
mavenCentral()
}
推荐答案
尝试将google()
方法移动到其执行块的顶部.
Try moving the google()
method to the top of its execution block.
可能是它在存储库中搜索的顺序导致了问题.
Maybe it's the order of repositories it searches in that causes the issue.
因此,例如,更改此内容:
So for example, change this:
repositories {
maven { url 'https://maven.fabric.io/public' }
google() // from here
mavenCentral()
}
对此:
repositories {
google() // to here
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
如果这样做没有帮助,请尝试将其更改为以下方法,而不是调用google()
方法:
If that doesn't help, instead of calling the google()
method, try changing it to this:
maven {
url 'https://maven.google.com/'
name 'Google'
}
更新
如果以上所有方法均无济于事-请确保您的gradle
版本至少为3.0.0
:
If all of the above didn't help - make sure your gradle
version is at least 3.0.0
:
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
gradle-wrapper
版本至少为4.1
:
通常位于此处:project_name/gradle/wrapper/gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
这篇关于Android CI构建:找不到aapt2-proto.jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!