由于公司网络都是内部服务器代理,然后访问网络,导致SDK有些依赖不能下载,所以新建项目出现如下问题:

Error:(24, 13) Failed to resolve: com.android.support:appcompat-v7:24.+

Error:(23, 17) Failed to resolve: junit:junit:4.12

这两个依赖作用分别是:

support:appcompat-v7:24.+:为了兼容4.0以下的Android系统。

junit:junit:4.12:单元测试用。

所以在用不到上述依赖的时候,可以去掉。

打开build.gradle,原先代码为:

dependencies {    compile fileTree(dir: 'libs', include: ['*.jar'])    testCompile 'junit:junit:4.12'    compile 'com.android.support:appcompat-v7:24.+'}
修改为:

dependencies {    compile fileTree(dir: 'libs', include: ['*.jar'])//    testCompile 'junit:junit:4.12'//    compile 'com.android.support:appcompat-v7:24.+'}
然后会发现styles.xml文件报错,还有一个是debug目录下的values.xml文件报错,其实都是去掉了
compile 'com.android.support:appcompat-v7:24.+'
依赖的原因,找到styles.xml,原先代码为:

        
替换为:(从其他没有错的项目中拷过来的)

                
然后点击“ Sync project With Gradle Files”按钮,这个按钮在工具栏,SDK Manager按钮旁边。

然后build successful!!!

这个东西本来就是巨坑,再加上公司网络访问有限制,哎!

更多相关文章

  1. Android原码下载问题:Using git with sock proxy behind firewal
  2. Gradle 依赖关系中 compile和 implementation的区别
  3. android上的一个网络接口和图片缓存框架enif
  4. Android中Button的几种点击的写法
  5. Android(安卓)连接Wifi和创建Wifi热点的实例
  6. android 播放器合集打包(源码来源网络)
  7. android wifi调试总结 theros AR6K命令小结 android wifi debug
  8. Android(安卓)studio gradle 依赖后报错后出现Failed to resolve
  9. android百度地图自定义marker,使用网络图片

随机推荐

  1. 【android】android 开发错误点滴积累5月
  2. Android(安卓)SlidingDrawer 抽屉效果的
  3. android 7种网络连接方式--IT蓝豹
  4. 如何去掉android 控件默认选中时的背景橘
  5. Roboletric+Retrofit2单元测试
  6. Android官方架构组件Navigation:大巧不工
  7. Android 界面设计工具 DroidDraw
  8. Loop,Handler,Message的机制
  9. Android干货·收集站
  10. Android ViewGroup中事件触发和传递机制