找不到Gradle DSL方法:'registerResGeneratingTask()'

时间:2015-08-19 19:20:48

标签: android gradle google-analytics android-gradle

我正在尝试在我的应用中添加google analytic

为此,我正在关注this教程。

当前的Gradle文件

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

dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
    classpath 'com.google.gms:google-services:1.3.0-beta1'
}

}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'

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

android {
compileSdkVersion 21
buildToolsVersion "21.1.1"

defaultConfig {
    applicationId "com.example.app.app"
    minSdkVersion 14
    targetSdkVersion 21
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}
}

dependencies {

compile 'com.android.support:appcompat-v7:21.0.+'
compile 'fr.avianey.com.viewpagerindicator:library:2.4.1@aar'
//noinspection GradleCompatible
compile 'com.android.support:support-v4:21.0.+'
compile 'com.android.support:multidex:1.0.+'
//compile 'com.squareup.okhttp:okhttp:1.5.4'
compile 'com.android.support:support-v13:21.0.+'
compile 'com.google.android.gms:play-services:3.1.+'
compile 'com.github.amlcurran.showcaseview:library:5.0.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
//For images
compile 'com.squareup.picasso:picasso:2.5.0'
compile('com.crashlytics.sdk.android:crashlytics:2.2.2@aar') {
    transitive = true;
}

compile 'com.google.android.gms:play-services-analytics:7.3.0'

}
  

错误:未找到Gradle DSL方法:'registerResGeneratingTask()'

1 个答案:

答案 0 :(得分:1)

我遇到同样的问题,我最初使用 classpath 'com.android.tools.build:gradle:1.0.0'。 比我改为classpath 'com.android.tools.build:gradle:1.2.3'。它可以解决这个问题。