这是我第一次尝试使用Android Studio。我安装了0.8.0并更新到0.8.2。只要一个项目被创建,我就会得到错误消息:

错误:(1,0)插件id 'com.android。未找到应用程序

C:\Users\Bob\ AndroidStudioProjects \ HelloAgain6 \ app \ build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.example.bob.helloagain6"
        minSdkVersion 15
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

和C:\Users\Bob\ AndroidStudioProjects \ HelloAgain6 \ build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.+'

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

allprojects {
    repositories {
        jcenter()
    }
}

当前回答

这也可能发生时,您有两个设置。Gradle和settings.gradle.kts文件在项目根目录中(可能包含相同的模块)。您应该只有其中一个文件。

其他回答

我在一个小时的错误信息中挣扎后发现了问题:

我不小心重命名了根版本。Gradle到build中的文件名。gradle,所以Android Studio不再识别它了。

将其重命名为build。Gradle解决了这个问题!

我也有类似的问题,我做了以下事情来解决它。 我参考了https://developer.android.com/studio/build 在应用插件行之前复制/粘贴下面这些行

repositories {
    google()
    jcenter()
}

dependencies {
    classpath 'com.android.tools.build:gradle:4.0.0'
}

}

只要确保在创建应用程序时正确地设置了http和https代理

检查拼写,我的是'com.android. application '

这也可能发生时,您有两个设置。Gradle和settings.gradle.kts文件在项目根目录中(可能包含相同的模块)。您应该只有其中一个文件。