2016-09-20 3 views
-1

Ich bin mit Android Studio 2.1.3 geführt von Create Hello-JNI with Android StudioGradle Dsl Methode nicht gefunden: android() Android Studio 2.1.3

Nach ausgegeben, während der Kompilierung.

Error:(3, 0) Gradle DSL method not found: 'android()' Possible causes:

  • The project 'FirstDemo' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0). Fix plugin version and sync project
  • The project 'FirstDemo' may be using a version of Gradle that does not contain the method. Open Gradle wrapper file
  • The build file may be missing a Gradle plugin. Apply Gradle plugin
  • build.gradle (Modul):

    apply plugin: 'com.android.model.application' 
    android { 
        compileSdkVersion 23 
        buildToolsVersion "23.0.1" 
        defaultConfig { 
         applicationId "com.example.sprinkle.firstdemo" 
         minSdkVersion 22 
         targetSdkVersion 23 
         versionCode 1 
         versionName "1.0" 
        } 
        buildTypes { 
         release { 
          minifyEnabled false 
          proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
         } 
        } 
    } 
    

    buil.gradle (oben)

    // 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-experimental:0.7.2' 
    
         // 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 
    //} 
    
    +0

    android {} soll im Modell eingewickelt werden {}. Es ist im Tutorial. –

    +0

    Hallo Ich versuchte mit dem gleichen ich bekam Fehler org.gradle.api.internal.ExtensibleDynamicObject – Nilesh

    +0

    so versucht, Modell – Nilesh

    Antwort

    0

    Seine Arbeits

    Changed

    proguardFiles getDefaultProguardFile ('proguard -androi d.txt '), 'proguard-rules.pro'

    TO

    proguardFiles.add(file('proguard-android.txt')) 
    proguardFiles.add(file('proguard-rules.txt')) 
    
    +0

    Proguard-android.txt ist im SDK-Verzeichnis, nicht in Ihrem Projekt-Verzeichnis. Sind Sie sicher, dass die Regeln tatsächlich angewendet werden? –

    +0

    Es funktionierte für mich, Kompiliert erfolgreich ohne Warnung/Fehler in android Studio 2.1.3 – Nilesh

    +0

    Natürlich kompiliert, das ist nicht von Frage. Hast du versucht, die Release APK zu starten? –

    Verwandte Themen