Android Studio:错误(2,0)无法在根项目' [ProjectName]'上找到参数[build_a4vgo3afez72iz8asoewhe39c $ _run_closure1 @ 7748caff]的方法android()类型为org.gradle.api.Project。
我刚开始是一名新程序员,但是我的Android Studio存在问题,因为我的项目无法成功构建。每个构建的响应是上述的响应。
您发现的任何可能是问题的根源? (提前致谢)
我的模块应用:
apply plugin: 'com.android.application'
apply plugin: 'java'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.rookr.scientificcalculator"
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.12'
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'
我的高端应用:
android {
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
}
答案 0 :(得分:0)
从顶级android
删除build.gradle
。
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
答案 1 :(得分:0)
从顶级构建中删除android
文件应该以buildscript
开头