美文网首页
Could not resolve com.android.su

Could not resolve com.android.su

作者: xiiyue | 来源:发表于2017-12-12 20:06 被阅读0次

今天刚刚从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仓库下载了。

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

相关文章

网友评论

      本文标题:Could not resolve com.android.su

      本文链接:https://www.haomeiwen.com/subject/hfanixtx.html