修复插件版本并同步Android Studio中的项目错误
我当前正在打开该文件Android Studio 2.1,并且该应用是在Android Studio版本1.5中创建的.
I am currently opening this file Android Studio 2.1 and the the app is created in Android Studio version 1.5.
Error:(1, 0) Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to "abf87974ef3c08e3258fe37c7d5001161385f549"
Fix plugin version and sync project
Open File
我在导入Android Project时遇到问题,并且显示错误.
按修复插件"后,显示无法更新".
I have problem during importing Android Project and it shows error.
After pressing "Fix Plugin" it shows me "Failed To Update".
这是我的build.gradle
文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "app.asharbhutta.com.challanlogin"
minSdkVersion 13
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
classpath 'com.android.tools.build:gradle:2.1.4'
}
这是gradle-wrapper.properties
This is gradle-wrapper.properties
#Wed Oct 21 11:34:03 PDT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip
I'm not able to find 'com.android.tools.build:gradle:2.1.4'
in Jcenter / Bintray.
因此,此错误是有道理的
Therefore, this error makes sense
修复插件版本并同步项目
Fix plugin version and sync project
截至本文,最新的稳定版本为2.1.2
As of this post, the latest stable version is 2.1.2
注意:Gradle与Android插件完全分开. gradle-2.14-bin
的版本并不总是与插件号匹配.
Note: Gradle is completely separate from the Android plugin. The version of gradle-2.14-bin
does not always match the plugin number.
这应该都是不言自明的,但是要澄清一下,这是更正后的build.gradle
.
This should all be self-explanatory, but to clarify, this is the corrected build.gradle
.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
app/build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "app.asharbhutta.com.challanlogin"
minSdkVersion 13
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
// classpath 'com.android.tools.build:gradle:2.1.4' // This shouldn't be here
}