2016-01-22 58 views
1

奇怪的是我在Android Studio中出現這個錯誤。之前沒有發生過。據我所知,我可能需要更新gradle版本到新版本。插件太老了,請更新到更新的版本,或者設置ANDROID_DAILY_OVERIDE

Error:(1, 0) Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to "xxxxxxxxxxx" 

這是我的build.gradle(項目:我的項目名稱放在這裏)文件。

buildscript { 
    repositories { 
     jcenter() 
    } 

    dependencies { 
     classpath 'com.android.tools.build:gradle:2.0.0-alpha3' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

的build.gradle(模塊:APP)

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.2" 

    defaultConfig { 
     applicationId "my project goes here" 
     minSdkVersion 14 
     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' 
} 

任何想法如何更新版本的Gradle?

謝謝。

回答

1

在頂部的build.gradle

classpath 'com.android.tools.build:gradle:1.3.0' 

目前,你有一個alpha構建是非官方被使用。切換到正式版本的一部分。

你也應該控制你的構建工具和其他項目在頂部build.gradle和不在模塊構建文件如圖所示。

把這個放在你的頂級項目gradle.build中,因爲沒有它你不能確保所有的模塊都能夠被兼容編譯,現在你必須單獨管理它。

ext { 
    compileSdkVersion = 23 
    buildToolsVersion = "23.0.1" 
    supportV4 = 'com.android.support:support-v4:21.0.3' 
} 
1

阿爾法6是最近剛剛發佈,所以儘量升級到

com.android.tools.build:gradle:2.0.0-alpha6

,看看是否能解決它。

+0

我不得不使用classpath'com.android.tools.build:gradle:1.5.0' 使它工作!基本上,我使用了較低版本的gradle! – Theo

+0

這很有道理,我不太熟悉gradle alpha通道,但是你應該總是使用最新的穩定版本,除非你特別想嘗試alpha特徵 – TheoKanning

相關問題