简体   繁体   English

crashlytics android studio gradle build失败

[英]crashlytics android studio gradle build failed

I have installed crashlytics plugin to android studio 0.9.3; 我已经安装了crashlytics插件到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'. 错误:任务':app:fabricCleanupResourcesDebug'的执行失败。

Crashlytics Developer Tools error. Crashlytics开发人员工具错误。

在此输入图像描述

Here is my gradle file, what should I change ? 这是我的gradle文件,我应该更改什么? Crashlytics added it's lines automatically: Crashlytics自动添加了它的行:

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

.

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. 在通过字符串引用而不是文字字符串替换AndroidManifest.xml文件中的API Key后,我遇到了完全相同的问题。
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" />

I have solved the issue. 我已经解决了这个问题。 I had long conversation with crashlytics team, but they didn't helped me. 我与crashlytics团队进行了长时间的交谈,但他们并没有帮助我。

My solution is to create separate project, and install crashlytics on that project. 我的解决方案是创建单独的项目,并在该项目上安装crashlytics。 It will generate api key on that project. 它将在该项目上生成api密钥。 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. 不知道为什么它没有在我的初始项目中生成密钥。

yes,I add this code in AndroidManifest.xml,it worked 是的,我在AndroidManifest.xml中添加了这段代码

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

在没有互联网连接的应用程序首次运行时,应用程序无法向服务器发送信息,因此请在服

This error due to wrong crashlaytics AppKey. 由于错误的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. 这是由于在清单文件中使用字符串资源而不是Hardcoded AppKey。

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 祝一切顺利

Open fabric.properties and check if value against apiKey reads YOUR_API_KEY . 打开fabric.properties并检查针对apiKey的是否YOUR_API_KEY If yes then copy your API Key from AndroidManifest.xml and paste it against apiKey in the fabric.properties. 如果是,则从AndroidManifest.xml复制您的API密钥,并将其粘贴到fabric.properties中的apiKey。

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

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