赞
踩
某个开源项目的build.gradle中,有一个github的raw源:
maven { url 'http://raw.github.com/saki4510t/libcommon/master/repository/' }
Android Studio编译时,出现DNS解析错误的问题。
Unknown host '请求的名称有效,但是找不到请求的类型的数据。 (raw.githubusercontent.com)'. You may need to adjust the proxy settings in Gradle.
- 3: Task failed with an exception.
- -----------
- * What went wrong:
- Could not resolve all files for configuration ':libuvccamera:debugCompileClasspath'.
- > Could not resolve com.serenegiant:common:2.12.4.
- Required by:
- project :libuvccamera
- > Could not resolve com.serenegiant:common:2.12.4.
- > Could not get resource 'http://raw.github.com/saki4510t/libcommon/master/repository/com/serenegiant/common/2.12.4/common-2.12.4.pom'.
- > Could not HEAD 'http://raw.github.com/saki4510t/libcommon/master/repository/com/serenegiant/common/2.12.4/common-2.12.4.pom'.
- > raw.githubusercontent.com
尝试了科学上网法依然不能下载,看起来是被彻底屏蔽了。
raw.githubusercontent.com是github的资源库,我们在github上存的库、图片、压缩包这类资源都是存在某处资源服务器上的,而不是直接存在github的web服务器上,估计是这里面有些政治敏感的内容,所以被屏蔽掉了。
https://gitee.com/cedardiao/libcommon
https://gitee.com/cedardiao/libcommon/tree/master/repository/com/serenegiant/common
点开里面的:maven-metadata.xml文件:
https://gitee.com/cedardiao/libcommon/blob/master/repository/com/serenegiant/common/maven-metadata.xml
将鼠标放到“原始数据”位置,右键,复制链接地址:
可以得到下面这个链接:
https://gitee.com/cedardiao/libcommon/raw/master/repository/com/serenegiant/common/maven-metadata.xml
取出前面一部分即可:
https://gitee.com/cedardiao/libcommon/raw/master/repository/
maven { url 'https://gitee.com/cedardiao/libcommon/raw/master/repository/'}
再次编译可以通过了。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。