情景再现:旧项目在 AndroidStudio 升级到 3.6 打开,调试APK无法 install ,提示错误(Failed to apply plugin [id 'com.android.application'] )。
我旧项目配置:
//Project gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
//gradle-wrapper.properties:
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip
修改过后配置:
//Project gradle:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
//gradle-wrapper.properties:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
最后 rebuild , Shift F10 , run app , 成功。。。
网友评论