Android CI 构建:找不到 aapt2-proto.jar [英] Android CI build: Could not find aapt2-proto.jar

查看:32
本文介绍了Android CI 构建:找不到 aapt2-proto.jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 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.

例如,更改此内容:

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆