【发布时间】: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).
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