2017-09-06 72 views
2

我在Android Studio中2.3.3创建空的项目,它在默认情况下具有compile 'com.android.support:appcompat-v7:26.+'在它的模块级build.gradle文件并将其编译好了,但是当我指定任何具体的版本从https://developer.android.com/topic/libraries/support-library/revisions.html#26-0-2 gradle这个同步失败有消息未能解决Android的支持库V7-程序兼容性

enter image description here

我也试过以下符号compile group: 'com.android.support', name:'v7-appcompat', version: '26.0.0',仍然没有成功。 我有

jcenter() 
    maven { 
     url "https://maven.google.com" 
    } 

在存储库secion中。 安装存储库和同步项目按钮不可点击。支持存储库更新: enter image description here

+0

做你尝试清洁您的构建?或者尝试文件>无效和缓存。 – DroiDev

+0

@DroiDev试过了,什么都没有发生 – Ilia

+0

可以尝试26.0。*? – DroiDev

回答

0

一定要使用:

compileSdkVersion 26 
buildToolsVersion "26.0.0" 

或更高版本。

无效高速缓存,去File>Invalidates Caches

enter image description here

Install Repository and sync Project链接只需点击安装缺少的依赖关系。

enter image description here

然后再次同步与gradle这个文件在您的项目。


二的解决方案,请尝试重新卸载重新安装一个Android Support Repository(我认为它类似于清水缓存):

enter image description here

+0

这是不正确的。自v.26以来,支持库位于谷歌maven仓库中,而不在SDK管理器中。 –

1

您misswrote制造品的名称。如下更改:

compile 'com.android.support:v7-appcompat:26.0.0'

compile 'com.android.support:appcompat-v7:26.0.0'

0

检查错误消息:

无法解析com.android.support:V7-程序兼容性: 26.0.0'

正确的库是程序兼容性-V7,而不是V7-程序兼容性

用途:

compile 'com.android.support:appcompat-v7:26.x.x' 
相关问题