我试着运行我的应用程序并得到了这个错误,请帮助我。
// 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:2.2.0'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
android {
signingConfigs {
config {
}
}
buildToolsVersion '24.0.2'
compileSdkVersion 24
buildTypes {
buildType {
signingConfig signingConfigs.config
}
}
}
dependencies {
}
错误:
错误:(22,0)找不到参数的方法android() 根目录下的[build_exkifxt5bplscorlvh4v3btv2 $ _run_closure3 @ 981984c] project' Recipe App'类型为org.gradle.api.Project。
答案 0 :(得分:0)
// 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:2.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
dexOptions {
incremental true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile files('app/libs/junit-4.12-JavaDoc.jar')
}
apply plugin: 'maven'`enter code here`
答案 1 :(得分:0)
我遇到了同样的问题并解决了问题:
了解更多详情here
答案 2 :(得分:0)
添加以下行:
apply plugin: 'com.android.feature'
在有问题的build.gradle文件的顶部并再次同步。