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是否已經下載,並安裝 
這里寫圖片描述

第二步:問題還是沒有解決,甚至報錯,習慣就好 
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

的 
這里寫圖片描述 
簡單說就是修改module的gradle 
1.把compileSdkVersion改26 
2.buildToolsVersion改”26.0.1” 
3.compile ‘com.android.support:appcompat-v7:26.0.1’替換之前的版本 
4.sync后會提示下載更新,完成后問題就解決了。

雖說問題解決了,但是也許解決方案並不是萬能的,如有其他情況未能解決也歡迎評論,同時qq群492462202歡迎交流。感覺有幫助就贊助一下吧 ! 

 

引用原文:https://blog.csdn.net/waa_studio/article/details/78732460

 

寫博客是為了記住自己容易忘記的東西,另外也是對自己工作的總結,文章可以轉載,無需版權。希望盡自己的努力,做到更好,大家一起努力進步!

如果有什么問題,歡迎大家一起探討,代碼如有問題,歡迎各位大神指正!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM