ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com

Android Studio3.6以上使用NavigationView控件添加依赖时问题

1.什么是NavigationView?
1.1.long long ago,我们做抽屉菜单的时候,左边滑出来的那一部分的布局都是由我们自己来定义的,自己写的话,花点时间也能做出来好看的侧拉菜单,但总是要耗费时间,于是Google在5.0之后推出了NavitationView,就是我们左边滑出来的那个菜单。这个菜单整体上分为两部分,上面一部分叫做HeaderLayout,下面的那些点击项都是menu,这样的效果如果我们要自己写肯定也能写出来,但是没有必要,既然Google提供了这个控件,那我们可以用这个控件提高开发效率。

2.NavigationView怎么用?(网上相关文章一大堆,感兴趣的可以去自行查资料,今天重点是记录使用过程出现的问题)

3.添加依赖:android Studio3.6以后添加NavigationView相关依赖implementation 'com.google.android.material:material:1.0.0’或者implementation ‘com.android.support:design:28.0.0’(两个依赖添加哪一个都可以),添加完依赖后Sync now同步项目报错:ERROR: Unable to resolve dependency for ‘:app@debugUnitTest/compileClasspath’: Could not resolve com.google.android.material:material:1.0.0.

4.解决办法:在AndroidStudio打开setting—Gradle,可以从下图的地址中找到自己本地的.gradle文件,我的在C盘。
ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com_第1张图片
4.1根据目录找到文件位置,然后打开gradle.properties文件,注释最后四行Http代理代码(如下图),重启Studio,问题解决
ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com_第2张图片

你可能感兴趣的:(android,Unable,to,resolve,dependency,for,':,android,studio)