Could not resolve com.android.su
2017-12-12 本文已影响0人
xiiyue
今天刚刚从Android 2.3 升级到Android studio 3.0.1,刚刚新建了一个项目,就出现一个bug
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仓库上下载。
sovle.png
编译ok即可将"将Offline work" 勾选上,这样以后新建的工程就不需要每次上google仓库下载了。