failed to resolve: com.android.support:appcompat-v7:27.+ 解决方法。新创建一个android studio project.出现了failed to resolve: com.android.support:appcompat-v7:27.+问题。
我的工作环境是 android studio 2.3.3。
app 下的 build.gradle文件内容如下:
apply plugin: 'com.android.application'
android {
compilesdkversion 27
buildtoolsversion "27.0.3"
defaultconfig {
applicationid "com.bestgo.facebookdownload"
minsdkversion 15
targetsdkversion 27
versioncode 1
versionname "1.0"
testinstrumentationrunner "android.support.test.runner.androidjunitrunner"
}
buildtypes {
release {
minifyenabled false
proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile filetree(dir: 'libs', include: ['*.jar'])
androidtestcompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:27.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testcompile 'junit:junit:4.12'
}
project下的build.gradle文件内容如下:
????
// top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// note: do not place your application dependencies here; they belong
// in the inpidual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: delete) {
delete rootproject.builddir
}
解决方法:
?在project 下的build.gradle 文件里的 allprojects加入以下代码:
????????maven {
? ? ? ? ? ? url "https://maven.google.com"
? ? ? ? }
加入后的build.gradle文件如下:
// top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// note: do not place your application dependencies here; they belong
// in the inpidual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: delete) {
delete rootproject.builddir
}