Failed to resolve: com.android.support:appcompat-v7:27.0.1问题解决

今天,在毫无征兆的情况下AndroidStudio又抽风了,搞了大半天,试了网上众多方案,终于解决了这个问题。咱们一步一步来

第一步:这是最开始的bug 
Error:Failed to resolve: com.android.support:support-annotations:27.0.1 
Install Repository and sync project
Open File
Show in Project Structure dialog 
Error:Failed to resolve: com.android.support:appcompat-v7:27.0.1 
Install Repository and sync project
Open File
Show in Project Structure dialog

这个问题可以通过修改project的gradle,添加maven { url “https://maven.google.com” }即可,如图 
这里写图片描述 
同时,打开SDK Manager 
这里写图片描述 
检查repository是否已经下载,并安装 
Failed to resolve: com.android.support:appcompat-v7:27.0.1问题解决_第1张图片

第二步:问题还是没有解决,甚至报错,习惯就好 
Error:A problem occurred configuring project ‘:app’.

Could not resolve all dependencies for configuration ‘:app:_debugApkCopy’. 
Could not find com.android.support:appcompat-v7:27.0.1. 
Required by: 
MakerOnly0818:app:unspecified 
MakerOnly0818:app:unspecified > com.gyf.barlibrary:barlibrary:2.1.4 
MakerOnly0818:app:unspecified > MakerOnly0818:imagepicker:unspecified 
Could not find com.android.support:appcompat-v7:27.0.1. 
Required by: 
MakerOnly0818:app:unspecified > com.roughike:bottom-bar:1.3.4 
Could not find com.android.support:appcompat-v7:27.0.1. 
Required by: 
MakerOnly0818:app:unspecified > com.bigkoo:convenientbanner:2.0.5 
Could not find com.android.support:appcompat-v7:27.0.1. 
Required by: 
MakerOnly0818:app:unspecified > com.zhy:flowlayout-lib:1.0.3 
Could not find com.android.support:support-v4:27.0.1. 
Required by: 
MakerOnly0818:app:unspecified > MakerOnly0818:slidingmenu:unspecified 
Could not find com.android.support:appcompat-v7:27.0.1. 
Required by: 
MakerOnly0818:app:unspecified > cn.yipianfengye.android:zxing-library:2.2 
Could not find com.android.support:support-v4:27.0.1. 
Required by: 
MakerOnly0818:app:unspecified > cn.yipianfengye.android:zxing-library:2.2 
Could not find com.android.support:appcompat-v7:27.0.1. 
Required by: 
MakerOnly0818:app:unspecified > me.weyye.hipermission:library:1.0.3 
Could not find com.android.support:appcompat-v7:27.0.1. 
Required by: 
MakerOnly0818:app:unspecified > MakerOnly0818:NIM_Android_UIKit-master:unspecified 
MakerOnly0818:app:unspecified > MakerOnly0818:NIM_Android_UIKit-master:unspecified > com.android.support:design:25.0.1 
Could not find com.android.support:support-v4:27.0.1. 
Required by: 
MakerOnly0818:app:unspecified > com.twitter.sdk.android:tweet-ui:3.1.0 
MakerOnly0818:app:unspecified > com.twitter.sdk.android:twitter-mopub:3.1.0 > com.mopub:mopub-sdk:4.11.0 
MakerOnly0818:app:unspecified > com.twitter.sdk.android:twitter-mopub:3.1.0 > com.mopub:mopub-sdk:4.11.0 > com.mopub:mopub-sdk-base:4.11.0 
MakerOnly0818:app:unspecified > com.twitter.sdk.android:twitter-mopub:3.1.0 > com.mopub:mopub-sdk:4.11.0 > com.mopub:mopub-sdk-banner:4.11.0 
MakerOnly0818:app:unspecified > com.twitter.sdk.android:twitter-mopub:3.1.0 > com.mopub:mopub-sdk:4.11.0 > com.mopub:mopub-sdk-interstitial:4.11.0 
MakerOnly0818:app:unspecified > com.twitter.sdk.android:twitter-mopub:3.1.0 > com.mopub:mopub-sdk:4.11.0 > com.mopub:mopub-sdk-rewardedvideo:4.11.0 
MakerOnly0818:app:unspecified > com.twitter.sdk.android:twitter-mopub:3.1.0 > com.mopub:mopub-sdk:4.11.0 > com.mopub:mopub-sdk-native-static:4.11.0 
MakerOnly0818:app:unspecified > com.twitter.sdk.android:twitter-mopub:3.1.0 > com.mopub:mopub-sdk:4.11.0 > com.mopub:mopub-sdk-native-video:4.11.0 
这个问题,可以通过注释掉module的gradle中的androidTestCompile部分代码即可。 
第三步:然后又爆出这个问题,问题已经好转,报错信息越来越少了哈哈 
Error:(15, 21) No resource found that matches the given name: attr ‘android:keyboardNavigationCluster’. 
通过下面这个链接的一个回答解决了,stackoverflow可能打不开,下面我介绍一下:如图就是解决方案 
https://stackoverflow.com/questions/45301203/no-resource-found-that-matches-the-given-name-attr-androidkeyboardnavigationc/45307273

的 
Failed to resolve: com.android.support:appcompat-v7:27.0.1问题解决_第2张图片 
简单说就是修改module的gradle 
1.把compileSdkVersion改26 
2.buildToolsVersion改”26.0.1” 
3.compile ‘com.android.support:appcompat-v7:26.0.1’替换之前的版本 
4.sync后会提示下载更新,完成后问题就解决了。

虽说问题解决了,但是也许解决方案并不是万能的,如有其他情况未能解决也欢迎评论,同时qq群492462202欢迎交流。感觉有帮助就赞助一下吧 ! 

原文:http://blog.csdn.net/waa_studio/article/details/78732460

你可能感兴趣的:(Failed to resolve: com.android.support:appcompat-v7:27.0.1问题解决)