今天,在毫无征兆的情况下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
写博客是为了记住自己容易忘记的东西,另外也是对自己工作的总结,文章可以转载,无需版权。希望尽自己的努力,做到更好,大家一起努力进步!
如果有什么问题,欢迎大家一起探讨,代码如有问题,欢迎各位大神指正!