14

I have installed crashlytics plugin to android studio 0.9.3; after this I added to my project; It added lines to gradle, first activity and so on...; after this build fails with this error:

Error:Execution failed for task ':app:fabricCleanupResourcesDebug'.

Crashlytics Developer Tools error.

enter image description here

Here is my gradle file, what should I change ? Crashlytics added it's lines automatically:

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'

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

android {
  compileSdkVersion 21
  buildToolsVersion "21.0.2"

  defaultConfig {
    applicationId "XXXXXXXXXXXXXXXXXXXXXXX"
    minSdkVersion 11
    targetSdkVersion 19
    versionCode 1
    versionName "1.0"
  }
  buildTypes {
    release {
      runProguard false
      proguardFiles getDefaultProguardFile('proguard-android.txt'),
      'proguard-rules.pro'
    }

  }
}

dependencies {
  compile fileTree(dir : 'libs', include : ['*.jar'])
  compile 'com.android.support:appcompat-v7:21.0.0'
  compile('com.crashlytics.sdk.android:crashlytics:2.1.0@aar') {
    transitive = true;
  }
}

.

Avi K.
  • 1,734
  • 2
  • 18
  • 28
Misha Akopov
  • 12,241
  • 27
  • 68
  • 82
  • The same problem here. However, there is another repository jcenter() (basing on the code given under https://dev.twitter.com/twitter-kit/android/integrate). Hope it helps & waiting for any answers here. – sitilge Dec 12 '14 at 10:02
  • Same here: http://stackoverflow.com/questions/27472452/crashlytics-found-an-invalid-api-key-androidstudio-build Let me know if you find solution. – bajicdusko Dec 14 '14 at 18:26

6 Answers6

11

I just had the exact same issue after replacing the API Key in the AndroidManifest.xml file by a string reference instead of a literal string.
Using the literal string, the error disappeared.

Use

<meta-data
        android:name="com.crashlytics.ApiKey"
        android:value="mykey" />

Don't use

<meta-data
        android:name="com.crashlytics.ApiKey"
        android:value="@string/crashlytics_api_key" />
grandouassou
  • 2,500
  • 3
  • 25
  • 60
  • florian here, android:value = "_my twitter API key_" is set but can't solve problem displaying error like : Plugin with id 'io.fabric' not found. – Dhruv Raval Mar 13 '15 at 13:03
  • Yeah I know, it also can't solve null pointer exceptions, np problems and all other problems I never said my answer would solve. The "exact same issue" I was referring to is "Error:Execution failed for task ':app:fabricCleanupResourcesDebug'." ;-) – grandouassou Mar 14 '15 at 13:41
  • 4
    I don't want to hardcode my key in the manifest. I wish that Twitter would fix this issue and support string references. – Splaktar May 03 '15 at 15:23
  • 1
    I think you can workaround this issue by using [placeholders](http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger#TOC-Placeholder-support) in the manifest file. Then in your build.gradle you can load properties (such as your API key) from an untracked (private) file and set your placeholder value. – grandouassou May 03 '15 at 20:26
10

I have solved the issue. I had long conversation with crashlytics team, but they didn't helped me.

My solution is to create separate project, and install crashlytics on that project. It will generate api key on that project. I just copied that key and pasted to my original project and it worked. Have no idea why it didn't generated the key on my initial project.

Misha Akopov
  • 12,241
  • 27
  • 68
  • 82
2

yes,I add this code in AndroidManifest.xml,it worked

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

On first run of app without internet connection, app can not send information to server, so register your app in server.

2

This error due to wrong crashlaytics AppKey. Please check your manifest file for confirm it. OR

It is due to use of a string resource instead of Hardcoded AppKey in manifest file.

Use this:

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

Dont Use this

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

All the best

Adam B
  • 3,775
  • 3
  • 32
  • 42
0

Open fabric.properties and check if value against apiKey reads YOUR_API_KEY. If yes then copy your API Key from AndroidManifest.xml and paste it against apiKey in the fabric.properties.

Devanshu Dwivedi
  • 693
  • 2
  • 6
  • 18