简体   繁体   English

Android gradle错误:(69,0)未找到Gradle DSL方法:“ compile()”

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

I'm having this very frustrating issue with my build.gradle file. 我的build.gradle文件遇到了一个非常令人沮丧的问题。 It started when I decided to add new library to my project: "Deter-master" lib. 当我决定将新库添加到项目中时,它开始了:“ Deter-master”库。

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. Gradle同步失败:在DefaultExternalModuleDependency {group ='com.android.support',name ='support-v13',version上找不到参数[com.android.support:appcompat-v7:25.0.0]的方法compile() = '25 .0.0',配置='default'},类型为org.gradle.api.internal.artifacts.dependencies.DefaultExternalModuleDependency。 Consult IDE log for more details (Help | Show Log) 有关更多详细信息,请查阅IDE日志(“帮助” |“显示日志”)

Below you can see all gradle files: 在下面可以看到所有gradle文件:

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}"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android Gradle构建错误:(65,0)未找到Gradle DSL方法:“ compile()” - Android gradle build Error:(65, 0) Gradle DSL method not found: 'compile()' 错误:未找到 Gradle DSL 方法:'compile()' - ERROR: Gradle DSL method not found: 'compile()' android错误:Gradle同步失败:未找到Gradle DSL方法:'classpath()' - android error : Gradle sync failed: Gradle DSL method not found: 'classpath()' Gradle 错误:找不到 Gradle DSL 方法:'executeWithoutThrowingTaskFailure()' - Gradle Error:Gradle DSL method not found: 'executeWithoutThrowingTaskFailure()' Google Glass,找不到Gradle DSL方法:“ android()” - Google Glass, Gradle DSL method not found: 'android()' 错误:(9,0):'google()'未找到Gradle DSL方法 - Error:(9, 0): 'google()' Gradle DSL method not found 错误:未找到 Gradle DSL 方法:“实施()” - ERROR: Gradle DSL method not found: 'imlementation()' Gradle突然无法建立。 找不到Gradle DSL方法:“ android()” - Gradle suddenly will not build. Gradle DSL method not found: 'android()' Neokree导航抽屉:未找到Gradle DSL方法:'compile()' - Neokree Navigation drawer: Gradle DSL method not found: 'compile()' 找不到Gradle DSL方法:storeFile() - Gradle DSL method not found: storeFile()
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM