文章目录
2、找到gradle-wrapper.properties文件
问题场景
AS引入带三方的sdk demo报错:
ERROR: Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-4.1-all.zip'
解决方式
1、修改版本号
在Android Studio中找到Project的build.gradle,把版本号改成当前Android Studio的版本
---注:打开一个没有问题的项目,这个文件的这句代码,直接复制进去即可
dependencies {
//classpath 'com.android.tools.build:gradle:3.0.1' //第三方sdk的
classpath 'com.android.tools.build:gradle:3.5.0' //修改后的
}
2、找到gradle-wrapper.properties文件
打开一个没有问题的项目,这个文件的这句代码,直接复制进去即可
#第三方sdk的
#distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
#修改后的
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
也就是把这两个文件的版本对应就好了
3、点击 Remove
点击 Remove minSdkVersion and sync project
ERROR: The minSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.
Remove minSdkVersion and sync project
Affected Modules: app
4、点击 Do Refactor
如下图: