当前位置:   article > 正文

Could not install Gradle distribution from ‘http://services.gradle.org/distributions/gradle-xx-all_http%3a%2f%2fservices.gradle.org%2fdistributions

http%3a%2f%2fservices.gradle.org%2fdistributions

原因是Android stdio导入他人的工程文件时,gradle和自己的版本不一样。

尝试了很多方法,但是只有一种解决了。记录一下。

Could not install Gradle distribution from 'http://services.gradle.org/distributions/gradle-xx-all

参考:https://zhidao.baidu.com/question/2204898032710914388.html?fr=iks&word=Could+not+install+Gradle+distribution+from+%27http%3A%2F%2Fservices.gradle.org%2Fdistr&ie=gbk

1.找一个能运行的as项目

2.打开gradle-wrapper.properties,文件目录:项目/gradle/wrapper/gradle-wrapper.properties

3.复制distributionUrl这一整行的内容,eg: distributionUrl=https://services.gradle.org/distributions/gradle-2.4-all.zip

4.打开你要导入的项目的gradle-wrapper.properties,具体步骤与步骤2相同

5.把步骤3复制的内容,替换你要导入的项目的gradle-wrapper.properties文件的distributionUrl这一行

6.再重启as,导入项目就可以了

之后报错变成了:

Gradle Error : Could not find com.android.tools.build:gradle:6.6.1

参考:https://stackoverflow.com/questions/63755131/gradle-error-could-not-find-com-android-tools-buildgradle6-6-1/64312995

解决方法:在build.gradle中修改这一段

dependencies {
    classpath 'com.android.tools.build:gradle:4.0.2'
}
  • 1
  • 2
  • 3

之后报错变成了

Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [id ‘c

参考:https://blog.csdn.net/weixin_44575660/article/details/108460564

Gradle.Scripts中的gradle.properties添加:

android.overridePathCheck=true
  • 1

然后就可以了。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/236172?site
推荐阅读
相关标签
  

闽ICP备14008679号