【发布时间】:2018-08-26 07:26:50
【问题描述】:
我试图将我的 Android Studio 2.2.3 更新到版本 3,但是当我这样做时,以下错误阻止了构建过程:
无法解析 ':app@debug/compileClasspath' 的依赖关系:无法解析 com.android.support:multidex:1.0.3。
无法解析 com.android.support:multidex:1.0.3。 要求: 项目:应用程序
无法解析 com.android.support:multidex:1.0.3。
无法解析 POM https://dl.google.com/dl/android/maven2/com/android/support/multidex/1.0.3/multidex-1.0.3.pom
已经看过的文档类型。
build.gradle(模块:app):
buildscript {
repositories {
jcenter()
flatDir {
dirs 'libs'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
apply plugin: 'com.android.application'
repositories {
jcenter()
flatDir {
dirs 'libs'
}
google()
}
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "My.App.Id"
minSdkVersion 17
targetSdkVersion 26
versionCode 111
versionName "1.1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:+'
compile 'com.android.support:design:+'
compile 'com.android.support:cardview-v7:+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.github.rahatarmanahmed:circularprogressview:+'
compile files('libs/devicedriverslib.jar')
compile files('libs/allutils.jar')
compile 'com.android.support:multidex:1.0.3'
}
build.gradle(Project: MyProjectName)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
gradle-wrapper.properties:
#Tue Oct 31 12:15:03 IST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
【问题讨论】:
-
app gradle 文件中
classpath 'com.android.tools.build:gradle:3.0.1'需要什么? -
这是必要的,正如samples中提到的那样
标签: android android-gradle-plugin