【问题标题】:Migrating from Eclipse... Error:(1, 0) Plugin with id 'com.android.application' not found从 Eclipse 迁移... 错误:(1, 0) 未找到 ID 为“com.android.application”的插件
【发布时间】:2015-01-09 10:09:52
【问题描述】:

我将我的项目从 eclipse 迁移到 android studio,我收到了这个错误:

Error:(1, 0) Plugin with id 'com.android.application' not found.

我有 gradle 2.2.1 和最新版本的 Android Studio 1.0.2

我的文件:

模块应用:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.myapp"
        minSdkVersion 14
        targetSdkVersion 19
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
        }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'
        compile 'com.google.android.gms:play-services-ads:6.5.87'
    }
}

项目:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

gradle 包装器属性:

#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip

【问题讨论】:

  • 奇怪。您可以发布您的gradle/wrapper/gradle-wrapper.properties 文件吗?
  • 将类路径 'com.android.tools.build:gradle:1.0.0' 移入 buildscript

标签: android gradle android-studio android-gradle-plugin


【解决方案1】:

一个工作的 gradle 构建文件。

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.14.2'
    }
}
apply plugin: 'com.android.application'

repositories {
    jcenter()
}

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {   
    compile 'com.google.android.gms:play-services:6.5.87'

}

【讨论】:

  • 还是同样的问题?
  • 如果您尝试过我发布的构建文件,请检查 compileSdkVersion。
猜你喜欢
  • 2015-10-14
  • 2014-09-07
  • 1970-01-01
  • 2023-03-19
  • 1970-01-01
  • 2020-02-17
  • 1970-01-01
相关资源
最近更新 更多