当我在 android studio 中创建一个新项目时,起初一切正常,并且可以在我的手机上运行。但是,如果我按下同步按钮,则会出现一个可怕的错误(我害怕并讨厌它):“未找到 ID 为 'com.android.application' 的插件”。我搜索并阅读与此错误相关的所有答案并做每件事。但我的问题也依然存在。这是我的 build.gradle(module.app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.masood.pietest"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
Run Code Online (Sandbox Code Playgroud)
这是我的 build.gradle(project):
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0-alpha09'
// NOTE: Do not place your …Run Code Online (Sandbox Code Playgroud)