android - 在圆圈 ci 中找不到 com.android.tools.build :gradle:3. 0.0-alpha1

标签 android android-studio gradle build circleci

我将gradle插件更新到最新版本:com.android.tools.build:gradle:3.0.0-alpha1,这个错误发生在AS:

export TERM="dumb"
if [ -e ./gradlew ]; then ./gradlew test;else gradle test;fi

FAILURE: Build failed with an exception.

What went wrong:
    A problem occurred configuring root project 'Android-app'. Could not
 resolve all dependencies for configuration ':classpath'. Could not
 find com.android.tools.build:gradle:3.0.0-alpha1. Searched in the
 following locations:
 https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha1/gradle-3.0.0-alpha1.pom
 https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha1/gradle-3.0.0-alpha1.jar
 Required by:

当前 CI 配置 circle.yml

dependencies:
   pre:
      - mkdir -p $ANDROID_HOME"/licenses"
      - echo $ANDROID_SDK_LICENSE > $ANDROID_HOME"/licenses/android-sdk-license"
      - source environmentSetup.sh && get_android_sdk_25

   cache_directories:
    - /usr/local/android-sdk-linux
    - ~/.android
    - ~/.gradle
   override:
    - ./gradlew dependencies || true

test:
  post:
    - mkdir -p $CIRCLE_TEST_REPORTS/junit/
    - find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;

machine:
    java:
        version: oraclejdk8

编辑: 我的 gradle 文件:

buildscript {
  repositories {
    jcenter()
    maven {
      url 'https://maven.google.com'
    }
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:3.0.0-alpha1'
    classpath 'com.google.gms:google-services:3.0.0'
    classpath "io.realm:realm-gradle-plugin:3.1.3"
  }
}

allprojects {
  repositories {
    mavenCentral()
    jcenter()
  }
}

task clean(type: Delete) {
  delete rootProject.buildDir
}

最佳答案

谷歌有新的 maven 仓库

https://android-developers.googleblog.com/2017/10/android-studio-30.html > Google 的 Maven 存储库

部分

https://developer.android.com/studio/preview/features/new-android-plugin-migration.html https://developer.android.com/studio/build/dependencies.html#google-maven

所以添加对maven repo的依赖:

buildscript {
    repositories {
        ...
        // You need to add the following repository to download the
        // new plugin.
        google() // new which replace https://maven.google.com
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.3'  //Minimum supported Gradle version is 4.6.
    }
}

关于android - 在圆圈 ci 中找不到 com.android.tools.build :gradle:3. 0.0-alpha1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44071080/

相关文章:

android - NavigationView 打开速度慢/跳帧(Android 设计库)

android - 从 GIT 中永久删除 .iml 文件

android - 将 netbeans android 项目导入 android studio

android - Android Studio 中缺少设备文件资源管理器

java - Gradle:具有不同源和目标兼容性的多项目

gradle - 依赖依赖的常规项目的gradle构建失败

android - Gradle aapt.exe 错误

android - 无论如何要将文本大小存储在可绘制对象中,这种方式取决于屏幕大小,main.xml 将选择正确的文本大小?

Android软键盘卡住可见布局直到关闭

java - 清除 Activity 堆栈