Closed daxueguai closed 2 months ago
maven源应该用https链接,而不是http
maven源应该用https链接,而不是http
请问具体怎么解决?
maven源应该用https链接,而不是http
请问具体怎么解决?
这源是自己配置的啊(阿里云的),你自己配置那你就多打个s啊
可以看一下系统用户目录下的 .gradle/init.gradle
文件中 的 repositories
选项中 的仓库配置 中有两个http协议的阿里云的仓库地址 修改为 https 的保存试试,我也是遇到了相同的问题 搞了两个晚上才定位到问题,我把完整的文件内容贴在下文,希望可以帮助到你。
// init.gradle 文件的完整配置
allprojects{
repositories {
// 文件中默认的地址是 http 协议的
//def MY_ALIYUN_REPOSITORY_URL = 'http//maven.aliyun.com/nexus/content/groups/public'
//def MY_ALIYUN_JCENTER_URL = 'http://maven.aliyun.com/nexus/content/repositories/jcenter'
// 修正后的内容如下
def MY_ALIYUN_REPOSITORY_URL = 'https//maven.aliyun.com/nexus/content/groups/public'
def MY_ALIYUN_JCENTER_URL = 'https://maven.aliyun.com/nexus/content/repositories/jcenter'
all { ArtifactRepository repo ->
if(repo instanceof MavenArtifactRepository){
def url = repo.url.toString()
if (url.startsWith('https://repo1.maven.org/maven2')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $MY_ALIYUN_REPOSITORY_URL."
remove repo
}
if (url.startsWith('https://jcenter.bintray.com/')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $MY_ALIYUN_JCENTER_URL."
remove repo
}
}
}
maven {
url MY_ALIYUN_REPOSITORY_URL
url MY_ALIYUN_JCENTER_URL
}
}
}
系统是不带这个的,只能是自己很久之前配置过但是又忘了
系统是不带这个的,只能是自己很久之前配置过但是又忘了
是的,我开了一个虚拟机 进行了测试,安装 AS 之后会在 系统用户目录下初始化一个 /.gradle
目录 ,确实没有init.gradle
文件。可能是因为其他原因配置过这个文件。
经过调查 init.gradle
起到一个全局注入的作用 并且优先级不低,在 gradle 不强制要求仓库链接使用 https 的协议的时候就得配置是没有问题的 在 grade 7.0 版本以后 就开始要求仓库链接使用 https 所以才会出现的类似问题
总结一下:这就是因为用户的一些环境配置导致的问题 我的回答仅仅作为一个排查方向
👋 Hey there, it looks like there has been no activity on this issue in the last 90 days. Has the issue been fixed, or does it still require the community attention? This issue will be closed in the next 7 days if no further activity occurs. Thank you for your contributions.
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.
error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'Atest64'.