Ich bin neu in Android-Programmierung finden, wenn ich versuche, mein erstes Projekt zu bauen, bekomme ich folgende Fehler -Gradle Sync fehlgeschlagen: Es kann keine Methode android() für Argumente auf Stammprojekt auf Android Studio
Gradle-Synchronisierung fehlgeschlagen: Die Methode android() für Argumente [build_ed74sxwq3zd69j7x0p9x4y5fb $ _run_closure3 @ 3d54d64f] für das Stammprojekt 'MyApplication' vom Typ org.gradle.api.Project konnte nicht gefunden werden.
// 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.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 {
compileSdkVersion 19
buildToolsVersion '25.0.2'
dexOptions {
incremental true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
}
dependencies {compile files('app/libs/junit-4.12-JavaDoc.jar')
}
apply plugin: 'maven'
Die App/build/gradle Datei -
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.surabhi.myapplication"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags "-std=c++11"
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.3.1'
testCompile 'junit:junit:4.12'
compile files('app/libs/junit-4.12-JavaDoc.jar') }
apply plugin: mavin