在AndroidStudio中新建项目后Gradle提示找不到依赖的解决办法

提示Could not resolve com.android.support:appcompat-v7:26.1.0

可能的原因有:1.使用了Graddle的offline work,将其取消勾选后再试

 

转载出处:https://blog.csdn.net/caohb2013/article/details/79543760

 

2. 使用的依赖包版本过高,在app Module中的build.gradle文件中尝试调整依赖包版本直至项目能正确构建:

调整dependences中的第二和第三个implementation。

apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
applicationId "com.bignerdranch.android.geoquizchallenge"
minSdkVersion 19
targetSdkVersion 28
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:28.0.0-alpha1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

posted @ 2018-11-22 16:19  天南星2018  阅读(1135)  评论(0编辑  收藏  举报