简体   繁体   English

Gradle 错误:找不到 Gradle DSL 方法:'executeWithoutThrowingTaskFailure()'

[英]Gradle Error:Gradle DSL method not found: 'executeWithoutThrowingTaskFailure()'

I've recently updated android SDK tools to v23 and now when I open a project of mine it cannot compile, im getting this message:我最近将 android SDK 工具更新到 v23,现在当我打开我的项目时它无法编译,我收到以下消息:

Error:Gradle DSL method not found: 'executeWithoutThrowingTaskFailure()'

Does someone knows what can be the issue here?有人知道这里有什么问题吗? Here is my app.gradle code:这是我的 app.gradle 代码:

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'
apply plugin: 'android-apt'
apply plugin: 'com.raizlabs.griddle'
apply plugin: 'com.neenbedankt.android-apt'

repositories {
    mavenCentral()
    maven { url 'https://maven.fabric.io/public' }
    maven { url "https://jitpack.io" }
}

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.myapp"
        minSdkVersion 10
        targetSdkVersion 23
        versionCode 2
        versionName "1.3.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {

    compile('com.crashlytics.sdk.android:crashlytics:2.5.0@aar') {
        transitive = true;
    }

    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:design:22.2.0'
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.jakewharton:butterknife:7.0.1'
    compile 'commons-io:commons-io:2.4'
    compile 'uk.co.chrisjenx:calligraphy:2.1.0'
    compile 'com.google.code.gson:gson:2.3.1'
    compile('com.github.nkzawa:socket.io-client:0.5.0') {
        exclude group: 'org.json', module: 'json'
    }
    //http
    compile 'com.squareup.retrofit:retrofit:1.9.0'
    //db
    apt 'com.raizlabs.android:DBFlow-Compiler:2.2.1'
    compile 'com.raizlabs.android:DBFlow-Core:2.2.1'
    compile 'com.raizlabs.android:DBFlow:2.2.1'
    //graph
    compile 'com.jjoe64:graphview:4.0.1'
    compile 'com.github.PhilJay:MPAndroidChart:v2.1.3'

    compile project(':mobihelp_sdk_android_v1.5.1')
    compile 'com.facebook.android:facebook-android-sdk:4.1.0'

    compile 'com.apptentive:apptentive-android:1.7.3@aar'

    compile "com.mixpanel.android:mixpanel-android:4.6.2"
    compile "com.google.android.gms:play-services:3.1+"
    compile 'com.github.lzyzsd:circleprogress:1.1.0@aar'

    compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
}

I might be late to the party, but my case is different, i need to import 2 maven URL, so what i did write in gradle is :我可能会迟到,但我的情况不同,我需要导入 2 个 maven URL,所以我在 gradle 中写的是:

maven 
{
    url 'https://maven.fabric.io/public', 
    url 'https://jitpack.io
}

where i should've write like this :我应该这样写的地方:

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

Go to File > Settings > Build, Execution, Deployment > Build Tools > Gradle转到文件>设置>构建、执行、部署>构建工具> Gradle

Make sure you select Use default gradle wrapper (recommended) at Project-level settings.确保在项目级别设置中选择使用默认 gradle 包装器(推荐)

Project-level settings项目级设置

Fixed mine by closing Adroid Studio and then通过关闭 Adroid Studio 然后修复我的问题

$ cd <project root>
$ rm -r .idea

Then start up Android Studio and re-open your project.然后启动 Android Studio 并重新打开您的项目。 This forces Gradle to build the project again and hopefully your issue will be sorted.这会迫使 Gradle 再次构建项目,希望您的问题能够得到解决。

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

dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

This should be in your project level gradle file这应该在您的项目级 gradle 文件中

And other dependencies in your app level gradle file以及应用级 gradle 文件中的其他依赖

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

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