crashlytics developer tools error when building android -gradle project - android

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.+'
}

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

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.

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

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" />

<meta-data
android:name="com.crashlytics.ApiKey"
android:value="your key" />
I had simillar issue. Just add these line to your Android manifest file.

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.

Related

Failed to generate apk from Android studio 3.1.1

When I try to generate a signed APK, I found this issue :
10:58 Generate Signed APK: Errors while building APK. You can find the errors in the 'Messages' view.
No cached version of com.android.tools.lint:lint-gradle:26.1.1 available for offline mode.
this is my android studio details :
Android Studio 3.1.1
Build #AI-173.4697961, built on April 4, 2018
JRE: 1.8.0_152-release-1024-b02 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
this block for signing the apk :
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.releaseconfig
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
} signingConfigs {
releaseconfig {
keyAlias 'release_key'
keyPassword 'xxxxx'
storeFile file('xxxxxx)
storePassword 'xxxx'
}
}
Per the Android Studio docs, your top-level build.gradle ought to have the google() repository added. Be sure to add it to the repositories under buildscript AND allprojects.
The latter one is what I missed the first time I edited this today after upgrading and that led directly to a Could not find com.android.tools.lint:lint-gradle:26.1.1. when I tried to build a release APK.
Solved (works for me) changing gradle version in the project build.gradle:
From this
classpath 'com.android.tools.build:gradle:3.1.1'
to this
classpath 'com.android.tools.build:gradle:3.0.1'
I think this version required updated libs and gradle.
try to change to compileSdkVersion 27 and libaries as.
implementation 'com.android.support:support-v4:27.1.0'
and gradle ver,
classpath 'com.android.tools.build:gradle:3.1.0'
Try Setting debug to True in release mode though debuggable should be set to false in release APK but currently this is the solution i get.
release {
debuggable true
}
Update
Adding the following code in gradle to make it work
lintOptions {
checkReleaseBuilds false
}
Check Settings > Build, Execution, Deployment > Compiler to see if Command-line Options contains --offline See this answer.
please open your AndroidStudio and find click File and then find settings.
second you click compiler and then find Command-line Options: remove --offline
lintOptions {
abortOnError false
}
//add this on gradle file inside android tag
Please use Analyze > Inspect Code to inspect your code
If your app could be compiled and running just fine but you failed to generate sign APK. For me, after running inspection it shows me a few errors in my code. I fixed all those errors then I could build sign APK just fine. Check this Answer for more option to fix this

Getting error while adding Facebook SDK in build.gradle

I am working on a project where I need to implement facebook login. For that purpose I followed the steps from the developer website as mentioned. But unfortunately getting build error after adding'com.facebook.android:facebook-android-sdk:4.1.0' in build.gradleas follows
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.facebook"
minSdkVersion 11
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
}
Error log which I am getting:
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not resolve com.facebook.android:facebook-android-sdk:4.1.0.
Required by: ExampleApp:app:unspecified
> No cached version of com.facebook.android:facebook-android-sdk:4.1.0 available for offline mode.
> No cached version of com.facebook.android:facebook-android-sdk:4.1.0 available for offline mode.
Please help me to resolve this issue which I am facing right for a couple of days. I am really helpless and stuck up with the solutions. Any kind of suggestions would be much useful to fix my issue.
Your log gives the answer:
No cached version of com.facebook.android:facebook-android-sdk:4.1.0 available for offline mode.
Gradle is in offline mode, so it cannot download a new version of your library.
Go to Preferences > Build, Execution, Deployment > Build Tools > Gradle
and disable "Offline work".
Preferences can be accessed from here:
You do not need repositories in this gradle file as you should have one "global" build.gradle so remove this entry from module's grade file. And you should also check what repository is set there as it should be jcenter() not mavenCentral() as the latter is replaced with jcenter() for some time now.
allprojects {
repositories {
jcenter()
}
}

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

I have this mainActivity
public class MainActivity extends RoboFragmentActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Crashlytics.start(this);
//setContentView(R.layout.activity_main);
Intent intent = new Intent(this, MainActivity_with_Fragment.class);
startActivity(intent);
finish();
}
}
this is my gradle.build
buildscript {
repositories {
jcenter()
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.14.2'
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'crashlytics'
repositories {
jcenter()
maven { url 'http://download.crashlytics.com/maven' }
}
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "com.example.stopcall.app"
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:21.0.3'
compile 'org.roboguice:roboguice:3.+'
provided 'org.roboguice:roboblender:3.+'
compile 'com.crashlytics.android:crashlytics:1.+'
}
When I run project build I get this compilation error:
Error:Gradle: Execution failed for task ':app:crashlyticsCleanupResourcesDebug'.
> Crashlytics Developer Tools error.
how can I fix this?
You need to add your API Key to the Android Manifest:
<application>
<meta-data
android:name="com.crashlytics.ApiKey"
android:value="your key here" />
</application>
This method solved my problem:
Remove or Comment this line (build.gradle):
// apply plugin: 'io.fabric'
or if you have an ApiKey, define fabric ApiKey (AndroidManifest.xml)
<meta-data
android:name="io.fabric.ApiKey"
android:value="yourApiKey012356465654" />
If you only want to compose a tweet with the SDK you can remove the line
apply plugin: 'io.fabric'
And the gradle build will work correctly
I also got the issue and resolved it by putting string directly in meta tag without defining the api key into string resources. e.g.
Replace
<meta-data
android:name="io.fabric.ApiKey"
android:value="#string/string_res_name_of_your_api_key" />
to
<meta-data
android:name="io.fabric.ApiKey"
android:value="your_api_key_string" />
When you follow the steps for adding an application in your Crashlytics dashboard, they have mentioned a step to add the api key. In my case I was getting the same error when I would try to fetch the key from the strings.xml file. The problem was that crashlytics plugin uses a runtime api key insertion method and hence the build fails as it is not able to get the key from the strings file.
I tried below step:
Add a manifest placeholder in your build.gradle's defaultConfig:
defaultConfig {
manifestPlaceholders = [ api_key_crashlytics:"xxxx__your_api_key"]}
In your AndroidManifest.xml add below code inside your application tag:
<meta-data
android:name="io.fabric.ApiKey"
android:value="${api_key_crashlytics}" />
This worked for me.
Please make sure you added
apply plugin: 'com.google.gms.google-services'
at the end of your build.gradle file.
Open the Fabric Plugin which is already installed and update the Crashlytics, your problem gets solved
I faced with this issue for sometimes, although I already had api key in manifest. Then I try assemble release apk before try to assemble to upload to Fabric. So let execute:
$ ./gradlew assembleRelease
then
$ ./gradlew assembleRelease crashlyticsUploadDistributionRelease
and it works well.
If you use distribution with Gradle you may have checked some properties like
ext.betaDistributionReleaseNotesFilePath=”path/to/release_notes.txt”
In our case we didn't have this file and the task crashed. To see the problem, go to Gradle console and check logs:
I tried all of your solution suggests under that question and others. But all of them did not solve my problem. I solved my problem. My solution may solve your problem. I created empty res folder under main folder. project->src->main->res
Most likely the ApiKey is not correct just check it out. Worked for me.
Your key may have been entered on the wrong Android Manifest
<meta-data
android:name="io.fabric.ApiKey"
android:value="yourApiKey" /> //You must have 40 words
You can get the code after registering and entering the project
https://fabric.io/home

Building app with library module cannot find AndroidManifest.xml

I want to build an Android App with AndroidAnnotations.
Here is a simplified version on GitHub which fails to build/pre-process: https://github.com/aiQon/androidannotationsexample
The app is composed of a main app module and a library module.
Both use AndroidAnnotations (AA). The lib module has a workaround to find the AndroidManifest.xml in debug builds (it refers to the release manifest, because gradle does not build the debug variant for libs).
However, the manifest is found for the library module but not for the main app.
The gradle file of the main app is:
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
android {
compileSdkVersion 21
buildToolsVersion "21.0.1"
defaultConfig {
applicationId "de.stelle_beratung.androidannotationslibraryexample"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
apt {
arguments {
androidManifestFile variant.outputs.processResources.manifestFile
resourcePackageName android.defaultConfig.applicationId
}
}
dependencies {
compile project(":mylibrary")
apt "org.androidannotations:androidannotations:3.2+"
compile 'org.androidannotations:androidannotations-api:3.2+'
}
Gradle complains with:
http://pastebin.com/QZtnHcZD
Could someone please point me in the right direction on how to build this simplified project to have a controller Bean in the lib module and reference it successfully in the main app activity by using AA?
I appreciate any help.
Since android gradle plugin 14.4, the following line does not work anymore:
variant.outputs.processResources.manifestFile orvariant.processResources.manifestFile
You have to use this one instead:
variant.outputs[0].processResources.manifestFile
Please note if you have multiple outputs (when using splits), you may want to use another output (other index than zero).
Ok I got it. Was using Android Studio from the Canary Channel. Going back to Beta solved the issue because I could use android gradle plugin 0.12.2. This solved everything.

crashlytics android studio gradle build failed

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.
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;
}
}
.
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" />
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.
yes,I add this code in AndroidManifest.xml,it worked
<meta-data
android:name="io.fabric.ApiKey"
android:value="yourapikey" />
On first run of app without internet connection, app can not send information to server, so register your app in server.
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
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.

Categories

Resources