简体   繁体   中英

Android gradle Error:(69, 0) Gradle DSL method not found: 'compile()'

I'm having this very frustrating issue with my build.gradle file. It started when I decided to add new library to my project: "Deter-master" lib.

This is the error message:

Gradle sync failed: Could not find method compile() for arguments [com.android.support:appcompat-v7:25.0.0] on DefaultExternalModuleDependency{group='com.android.support', name='support-v13', version='25.0.0', configuration='default'} of type org.gradle.api.internal.artifacts.dependencies.DefaultExternalModuleDependency. Consult IDE log for more details (Help | Show Log)

Below you can see all gradle files:

apply plugin: 'com.android.application'

ext {
    libraries = [
            support : "25.0.0",
            location: "9.8.0"
    ]
}
def config = project.ext.libraries


repositories {
    mavenCentral()
    mavenLocal()
    flatDir {
        dirs 'libs'
    }
    maven { url 'https://maven.fabric.io/public' }
}
repositories {
    maven {
        url 'https://dl.bintray.com/blipinsk/maven/'
    }
}

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"

    defaultConfig {
        applicationId "com.airnauts.kaktus"
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
    }
    signingConfigs {
        debug {
            storeFile file("../social_keystore.jks")
            storePassword "social"
            keyAlias "social"
            keyPassword "social"
        }
        release {
            storeFile file("../social_keystore.jks")
            storePassword "social"
            keyAlias "social"
            keyPassword "social"
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

android {
    packagingOptions {
        exclude 'LICENSE.txt'
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile(name: 'toolkit', ext: 'aar')
    compile "com.android.support:support-v13:${config.support}" compile "com.android.support:appcompat-v7:${config.support}" compile "com.android.support:support-v4:${config.support}" compile "com.android.support:recyclerview-v7:${config.support}" compile "com.android.support:design:${config.support}" compile "com.android.support:cardview-v7:${config.support}" compile "com.android.support:percent:${config.support}" compile "com.google.android.gms:play-services-location:${config.location}" compile "com.google.android.gms:play-services-maps:${config.location}"
    //blipinsk
    compile 'com.firebaseui:firebase-ui-auth:0.6.2'
    compile 'com.bartoszlipinski:viewpropertyobjectanimator:1.2.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.jakewharton:butterknife:7.0.0'
    compile 'com.makeramen:roundedimageview:2.2.0'
    compile 'de.greenrobot:eventbus:2.4.0'
    compile 'uk.co.chrisjenx:calligraphy:2.1.0'
    compile 'com.facebook.android:facebook-android-sdk:4.7.0'
    compile 'me.kaelaela:verticalviewpager:1.0.0@aar'
    compile 'com.google.code.gson:gson:2.2.4'
    compile 'com.google.firebase:firebase-auth:9.8.0'
    compile 'com.firebaseui:firebase-ui:1.0.0'
    compile 'com.android.support:support-v4:25.1.0'
    compile 'com.karumi:dexter:4.1.0'
    compile project('Libraries:Dexter-master')
}

apply plugin: 'com.google.gms.google-services'

Another part:

// 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.2'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
        flatDir {
            dirs 'libs'
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

And the last one:

include ':app'
include ':app:Libraries:Dexter-master'

Try replacing:

compile "com.android.support:support-v13:${config.support}" compile "com.android.support:appcompat-v7:${config.support}" compile "com.android.support:support-v4:${config.support}" compile "com.android.support:recyclerview-v7:${config.support}" compile "com.android.support:design:${config.support}" compile "com.android.support:cardview-v7:${config.support}" compile "com.android.support:percent:${config.support}" compile "com.google.android.gms:play-services-location:${config.location}" compile "com.google.android.gms:play-services-maps:${config.location}"

with:

compile "com.android.support:support-v13:${config.support}"
compile "com.android.support:appcompat-v7:${config.support}"
compile "com.android.support:support-v4:${config.support}"
compile "com.android.support:recyclerview-v7:${config.support}"
compile "com.android.support:design:${config.support}"
compile "com.android.support:cardview-v7:${config.support}"
compile "com.android.support:percent:${config.support}"
compile "com.google.android.gms:play-services-location:${config.location}"
compile "com.google.android.gms:play-services-maps:${config.location}"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM