【问题标题】:Could not find android-maven-gradle-plugin.jar in Android Studio 3.1?在 Android Studio 3.1 中找不到 android-maven-gradle-plugin.jar?
【发布时间】:2018-09-08 00:27:35
【问题描述】:

我的 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'
}

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

【问题讨论】:

  • 你应用插件了吗apply plugin: 'com.github.dcendents.android-maven'
  • @AmjadKhan 我将它添加到 app/build.gradle 中。但它没有工作。
  • 你确定 android studio 没有处于离线模式吗?否则试试这个stackoverflow.com/questions/49510176/…
  • 尝试删除 apply plugin: 'android-maven' 并检查或在这里您可能会找到您的解决方案 stackoverflow.com/questions/28871084/…
  • @SantanuSur 我确定 android studio 没有处于离线模式。

标签: java android android-studio gradle


【解决方案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

【讨论】:

    猜你喜欢
    • 2018-09-07
    • 2015-05-14
    • 2015-03-24
    • 2021-05-13
    • 2018-09-09
    • 1970-01-01
    • 1970-01-01
    • 2018-04-08
    • 1970-01-01
    相关资源
    最近更新 更多