我的Android在Android Studio 3.0.1中可以正常工作,但是在我更新到Android Studio 3.1之后,它显示跟随构建错误。

Could not find android-maven-gradle-plugin.jar (com.github.dcendents:android-maven-gradle-plugin:2.0).

在以下位置搜索:
https://jcenter.bintray.com/com/github/dcendents/android-maven-gradle-plugin/2.0/android-maven-gradle-plugin-2.0.jar

build.gradle 类似于以下内容:
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
        jcenter()
        maven {
            url "https://maven.google.com"
        }

    }
}

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

并在app/build.gradle中:
apply plugin: 'com.android.application'
apply plugin: 'android-maven'
apply plugin: 'com.github.dcendents.android-maven'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.aitrix.wen.seaglider"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:design:26.1.0'
    testImplementation 'junit:junit:4.12'
    compile project(':AHRSView')
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

我错过了什么吗?提前致谢。

最佳答案

更新以下内容后,该项目运行正常。

更新资料

classpath 'com.android.tools.build:gradle:3.0.1'


classpath 'com.android.tools.build:gradle:3.1.0'

并更新
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'


classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'

也将gradle-wrapper.properties更新为
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

关于java - 在Android Studio 3.1中找不到android-maven-gradle-plugin.jar?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49549421/

10-09 06:56
查看更多