【问题标题】:Fix plugin version and sync project Error In Android Studio修复 Android Studio 中的插件版本和同步项目错误
【发布时间】:2016-08-03 15:28:39
【问题描述】:

我目前在 Android Studio 2.1 中打开此文件,该应用是在 Android Studio 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 项目时遇到问题,它显示错误。
按“修复插件”后,它显示“更新失败”。

这是我的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

#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

【问题讨论】:

  • 你的 Gradle 插件太旧了?请显示build.gradle 文件。
  • 是的,我知道,请告诉我如何解决它..
  • @cricket_007 现在你可以看到我的 gradle 文件了 ..
  • 谢谢!现在,应该有两个...一个在项目的根目录中,另一个在app/ 目录中。如果不是这样,那么您是如何生成这个项目的?
  • 我已经提到我已经导入了这个应用程序..

标签: android android-studio


【解决方案1】:

我在Jcenter / Bintray 中找不到'com.android.tools.build:gradle:2.1.4'

因此,这个错误是有道理的

修复插件版本并同步项目

截至发文,最新稳定版为2.1.2

注意:Gradle 完全独立于 Android 插件。 gradle-2.14-bin 的版本并不总是与插件号匹配。


这一切都应该是不言自明的,但要澄清的是,这是更正后的build.gradle

项目/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
}

【讨论】:

  • 你能告诉我如何阅读代码...因为我需要这个项目代码..
  • com.android.tools.build:gradle:2.1.4 -- 将此2.1.4 更改为您可以从 BinTray 中找到的数值
  • 点击我的回答中的“Bintray”链接。 Bintray 是一个网站。不属于 Android Studio。
  • 比,,..?谁可以看到你告诉我的号码..?
  • @MusaJutt 很抱歉您遇到了困难,但我不知道该怎么解释。
【解决方案2】:

在 Build.gradel 中 在 Dependencies 类路径中以 + 符号结尾,如我所示

类路径'com.android.tools.build:gradle:2.2.0+'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-21
    • 2015-06-17
    • 2018-12-30
    • 2014-01-30
    相关资源
    最近更新 更多