Android(安卓)Studio中,新建项目出现依赖问题
16lz
2021-01-26
由于公司网络都是内部服务器代理,然后访问网络,导致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!!!
这个东西本来就是巨坑,再加上公司网络访问有限制,哎!
更多相关文章
- Android原码下载问题:Using git with sock proxy behind firewal
- Gradle 依赖关系中 compile和 implementation的区别
- android上的一个网络接口和图片缓存框架enif
- Android中Button的几种点击的写法
- Android(安卓)连接Wifi和创建Wifi热点的实例
- android 播放器合集打包(源码来源网络)
- android wifi调试总结 theros AR6K命令小结 android wifi debug
- Android(安卓)studio gradle 依赖后报错后出现Failed to resolve
- android百度地图自定义marker,使用网络图片