1

My Android is work fine in Android Studio 3.0.1 , but it show the follow build error after I update to the Android Studio 3.1.

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

Searched in the following locations: https://jcenter.bintray.com/com/github/dcendents/android-maven-gradle-plugin/2.0/android-maven-gradle-plugin-2.0.jar

The build.gradle is like the following:

// 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
}

And in 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'
}

Did I missing something ? Thanks in advance.

Jerome
  • 1,153
  • 1
  • 17
  • 28
Wun
  • 6,211
  • 11
  • 56
  • 101
  • Have you apply the plugin `apply plugin: 'com.github.dcendents.android-maven'` – Amjad Khan Mar 29 '18 at 06:34
  • @AmjadKhan I add it in the app/build.gradle. But it did not working. – Wun Mar 29 '18 at 06:40
  • are you sure android studio is not in offline mode ? else try this https://stackoverflow.com/questions/49510176/android-studio-gradle-sync-failed-could-not-head-received-status-code-5/49510333#49510333 – Santanu Sur Mar 29 '18 at 06:48
  • Try to remove `apply plugin: 'android-maven'` and check or here you may find your solution https://stackoverflow.com/questions/28871084/how-to-fix-plugin-with-id-com-github-dcendents-android-maven-not-found-in-and – Amjad Khan Mar 29 '18 at 06:49
  • @SantanuSur I'm sure the android studio is not in offline mode. – Wun Mar 29 '18 at 06:56
  • if its not in offline mode ..try the above solution !! – Santanu Sur Mar 29 '18 at 06:58

1 Answers1

1

After I update the following , the project work fine.

Update

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

to

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

And Update

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

to

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

also update the gradle-wrapper.properties to

distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
Wun
  • 6,211
  • 11
  • 56
  • 101