Could not resolve com.android.support:appcompat-v7:27+.(Android studio 2.3 升级到3.0.1的一个bug)

今天刚刚从Android 2.3 升级到Android studio 3.0.1,刚刚新建了一个项目,就出现一个bug


Could not resolve com.android.support:appcompat-v7:27+.(Android studio 2.3 升级到3.0.1的一个bug)_第1张图片
error.png

具体错误日志如下:

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:27+.

Could not resolve com.android.support:appcompat-v7:27+.
Required by:
    project :app
 > No cached version listing for com.android.support:appcompat-v7:27+ available for offline mode.
 
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.android.support:appcompat-v7:27+.

Could not resolve com.android.support:appcompat-v7:27+.
Required by:
    project :app
 > No cached version listing for com.android.support:appcompat-v7:27+ available for offline mode.
 
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.android.support:appcompat-v7:27+.

Could not resolve com.android.support:appcompat-v7:27+.
Required by:
    project :app
 > No cached version listing for com.android.support:appcompat-v7:27+ available for offline mode.
 
Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve com.android.support:appcompat-v7:27+.

Could not resolve com.android.support:appcompat-v7:27+.
Required by:
    project :app
 > No cached version listing for com.android.support:appcompat-v7:27+ available for offline mode.
 
 Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve com.android.support:appcompat-v7:27+.

Could not resolve com.android.support:appcompat-v7:27+.
Required by:
    project :app
 > No cached version listing for com.android.support:appcompat-v7:27+ available for offline mode.

解决方法

在Android studio 中 File -> Settings... -> Build,Execution,Deployment -> Gradle 中将Global gradle settings 中的"Offline work" 勾选去掉,再重新编译,即可将所缺的库从google仓库上下载。


Could not resolve com.android.support:appcompat-v7:27+.(Android studio 2.3 升级到3.0.1的一个bug)_第2张图片
sovle.png

编译ok即可将"将Offline work" 勾选上,这样以后新建的工程就不需要每次上google仓库下载了。

参考:https://stackoverflow.com/questions/46999594/unable-to-resolve-dependency-for-appdebug-compileclasspath-could-not-resolv

你可能感兴趣的:(Could not resolve com.android.support:appcompat-v7:27+.(Android studio 2.3 升级到3.0.1的一个bug))