54

I'm trying to build an android gradle project using eclipse, but i get this error when building the project using the command line:

 FAILURE: Build failed with an exception.

 * What went wrong:
 Execution failed for task ':app:crashlyticsCleanupResourcesRelease'.
 > Crashlytics Developer Tools error.

 * Try:
 Run with --stacktrace option to get the stack trace. Run with --info or --debug
 option to get more log output.

 BUILD FAILED

I'm using gradle version 1.10 also tried gradle version 1.12 but i get the same error

and here is my build.gradle file :

        buildscript {
            repositories {
                mavenCentral()
                maven { url 'http://download.crashlytics.com/maven' }
            }
            dependencies {
                classpath 'com.android.tools.build:gradle:0.12.+'
                classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
                classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.10.+'
            }
        }
        apply plugin: 'android-sdk-manager'
        apply plugin: 'android'
        apply plugin: 'crashlytics'

        repositories {
            mavenCentral()
            maven { url 'http://download.crashlytics.com/maven' }
        }

        android {
            compileSdkVersion 19
            buildToolsVersion "19.1.0"
            lintOptions.checkReleaseBuilds false

            defaultConfig {
                minSdkVersion 7
                targetSdkVersion 19
            }

            signingConfigs {
                release {
                    storeFile file(STORE_FILE)
                    storePassword STORE_PASSWORD
                    keyAlias KEY_ALIAS
                    keyPassword KEY_PASSWORD
                }
            }

            buildTypes {
              debug {

               ext.enableCrashlytics = false
               buildConfigField "boolean", "LOG_CRASHES", "false"
              }

              release {
                 buildConfigField "boolean", "LOG_CRASHES", "true"
                 runProguard true
                 proguardFile 'proguard.cfg'
                 signingConfig signingConfigs.release
              }
            }
        }

        dependencies {
            compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
            compile 'com.android.support:support-v4:19.1.0'
            compile 'com.crashlytics.android:crashlytics:1.+'
        }
user2469133
  • 1,940
  • 3
  • 21
  • 33

6 Answers6

38

Had a similar error trying to use Fabric's Twitter Kit

Error:Execution failed for task ':app:fabricCleanupResourcesDevDebug'.
> Crashlytics Developer Tools error.

Detailed error

ERROR - Crashlytics Developer Tools error. java.lang.IllegalArgumentException: Crashlytics found an invalid API key: XXXXXXXXX. Check the Crashlytics plugin to make sure that the application has been added successfully! Contact support@fabric.io for assistance.

After login in Fabric, download the AndroidStudio plugin and let it configure everything all worked fine.

(Btw, I really don't like this setup flow)

EDIT: It also can be done without install the AndroidStudio plugin. Follow these instructions from the Fabric site https://fabric.io/downloads/gradle

Antonio Jose
  • 2,778
  • 3
  • 21
  • 26
  • 1
    Works like charm! Thanks. Additional info for all: Once you install the plugin, open the plugin and install crashlytics 2.5.5. It prompts a question - whether gradle files should be updated. Choose yes. Crashlytics errors get resolved after gradle sync is done. – Vadiraj Purohit Apr 19 '16 at 03:05
  • If none of the above works for you just open the build.gradle class and comment the following as: //apply plugin: 'io.fabric' – James Lobo Nov 04 '16 at 07:09
20

This is not a solution to the original question, but you can also run into this error another way. If you are following docs for the Gradle Advanced Setup you might have included the following code

debug {
    ext.enableCrashlytics = false
}

Now if you are testing your application you may have tried to set ext.enableCrashlytics = true instead. Apparently this will cause errors for Crashlytics though and is not a valid value for this variable.

So if you want Crashlytics enabled for debug builds you'll need to comment out this line while you are testing or remove it altogether.

Andrea Thacker
  • 3,440
  • 1
  • 25
  • 37
13

By adding this line to your Application's Manifest inside tag

<meta-data
        android:name="io.fabric.ApiKey"
        android:value="XXXXXXXXXXXXXXX" />

I resolved this issue

Zahid Ali
  • 239
  • 5
  • 11
9

I fixed this issue by replacing "io.fabric.ApiKey" with "com.crashlytics.ApiKey" in AndroidManifest.xml (I don't like to change the Crashlytics lib). So the final one is:

 <meta-data
     android:name="com.crashlytics.ApiKey"
     android:value="xxxxxxxx" />
Alan Zhiliang Feng
  • 1,774
  • 18
  • 20
5
<meta-data
     android:name="com.crashlytics.ApiKey"
     android:value="your key" />

I had simillar issue. Just add these line to your Android manifest file.

Alexander Farber
  • 21,519
  • 75
  • 241
  • 416
prsandroid
  • 88
  • 2
  • 10
1

So I was having this issue and resolved it.

Basically, I was trying to use @string/crashlytics_key_prod, instead of putting in the actual key.

Replacing "@string/crashlytics_key_prod" by the actual key in the manifest resolved this issue for me.

Shubham Gupta
  • 424
  • 5
  • 4