Java – parameter org.org not found gradle. api. Project method (Android)

I got a bug. When I tried to compile my project in the studio, I had searched a lot without a real solution

Error: (17,0) can't be in type org gradle. api. Find the method Android () of the parameter [build_a7zf1o8ge4ow4uolz6kqzw5ov $_run_closure2 @ 19201053] in the root project 'booksstudiodir' of project

This is an example of my build / gradle file

buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
  }
 }
  apply plugin: 'com.android.application'
apply plugin: 'io.fabric'


android {
compileSdkVersion 21
buildToolsVersion "23.0.1"

defaultConfig {
    applicationId "com.peade.time"
    minSdkVersion 10
    targetSdkVersion 13
}
signingConfigs {
    release {
        storeFile file("/home/bestman/Desktop/mkey/key")
        storePassword "androidkeys"
        keyAlias "peade"
        keyPassword "yes1234"
    }
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.txt'
        signingConfig signingConfigs.release
     }
  }
}
  repositories {
    maven { url 'https://maven.fabric.io/public' }
    mavenCentral()
 }
dependencies {
   compile 'com.edmodo:cropper:1.0.1'
   compile 'com.android.support:support-v4:21.0.3'
   compile 'com.itextpdf:itextpdf:5.5.6'
   //    compile files('libs/commons-lang3-3.3.2.jar')
   compile files('libs/drop@R_8_2419@-android-sdk-1.6.1.jar')
   //    compile files('libs/httpmime-4.0.3.jar')
   compile files('libs/json_simple-1.1.jar')
   compile files('libs/picasso-2.5.2.jar')
   compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') {
    transitive = true;
   }
   compile project(':owncloud')
 }

Solution

There are two build Gradle file One is the top holder, the other is the module holder

The following is an example

Top level build gradle: https://github.com/nickbutcher/plaid/blob/master/build.gradle

Module build gradle: https://github.com/nickbutcher/plaid/blob/master/app/build.gradle

The Android block should be in the build.exe of the module In gradle I guess you have to build at the top Android blocks are defined in gradle, which leads to errors

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>