I want to integrate Firebase Crashlytics into my Android game (developed using Cocos2D-X engine).
I have followed the steps mentioned in this link.
I'm getting following error when building the project using Android Studio:
ERROR - Crashlytics Developer Tools error.
java.lang.IllegalArgumentException: Crashlytics found an invalid API key: null.
Check the Crashlytics plugin to make sure that the application has been added successfully!
It looks like that I am missing some API key. How can I find the Crashlytics API key in Firebase? How to mention that key in the Android project?
I would appreciate any suggestions and thought on this topic. Thank you.
Rolling back to "com.google.gms:google-services:4.0.1" in my project build.gradle file fixed the problem for me.
The Firebase docs say to use version 4.1.0, which if you follow will give the error above.
Please note the following things, this should solve your issue:
Check Android Studio version, suggested version is 3.1.4.
Classpath (project-level build.gradle file shouldn't have any alpha or beta versions. That is because Firebase only supports stable version of Android Studio.
That said, the recommended setup of your gradle version is:
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:4.1.0'
Firebase Crashlytics requires the Google services Gradle plugin (com.google.gms:google-services) in your build script to process the google-services.json file at build time. However, Crashlytics does work on devices that do not have Google Play services.
I have added this line at end of build.gradle
apply plugin: 'com.google.gms.google-services'
Related
During update of my android app, i updated all dependencies. When i tested the release build, i receive the following error:
E/CrashlyticsCore: The Crashlytics build ID is missing. This occurs when Crashlytics tooling is absent from your app's build configuration. Please review Crashlytics onboarding instructions and ensure you have a valid Crashlytics account.
Crashlytics is working fine for my previous release that is currently available on the play store.
Any help will be appreciated.
UPDATE: October 6, 2020
So a fix is available now for using Crashlytics. Follow this link from Firebase
https://firebase.google.com/docs/crashlytics/upgrade-sdk?platform=android
Earlier Accepted Answer.
After talking with fabric team, they told me that it is a known issue. To solve this, we have to include the
apply plugin: 'io.fabric'
in the build.gradle file of the app module. Including this will give the following warning:
WARNING: API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()'.
It will be removed at the end of 2019.
You can ignore this warning for now. Hopefully a fix for this issue will be provided soon.
It is fixed in the latest version, you can update your version with 1.28.0.
buildscript {
// ... repositories, etc. ...
dependencies {
// ...other dependencies ...
classpath 'io.fabric.tools:gradle:1.28.0'
}
}
Like many people, I am not able to add my application with Firebase Crashlytics.
I followed all the steps from the official documentation.
Also I previously checked and added my application to Firebase and everything is working fine.
My issue is the following:
ERROR - Crashlytics Developer Tools error.
java.lang.IllegalArgumentException: Crashlytics found an invalid API key: null.
Check the Crashlytics plugin to make sure that the application has been added successfully!
Contact support#fabric.io for assistance.
I have the google-services.json file set correctly.. From the official documentation, it should works now without anything else to do..
Edit - Solution
Like I said in the comments, I found the issue. It's because of the Gradle version that I was using. I moved my project to support AndroidX and I was using the latest version 3.3+ but with this version the google-services.json file is not parsed during the build phase. It is resolved with the 3.2+ version.
From Firebase team, only stable version are working.
Is your project built to support instant apps (i.e. you have a base feature module, installable module, and instant app module)? I've been dealing with this exact error for the last day and a half, and what finally fixed it for me was adding crashlytics { instantAppSupport true } to the bottom of my gradle file for my base feature module. If you are built for instant apps, this might be worth a shot.
Are you sure you have added the Crashlytics API Key in one of these files?
AndroidManifest.xml:
<meta-data
android:name="io.fabric.ApiKey"
android:value="xxxxxxxxxxxxxxxxxxxxxxxxxxx" />
Fabric Properties:
# Fabric properties file: app/fabric.properties
apiSecret=xxxxxxxxxxxxxxxxxxxxxxxxxxx
apiKey=xxxxxxxxxxxxxxxxxxxxxxxxxxx
Am new to cordova, I have created a cordova app and run successfully, now I need to integrate a push notification in it. So i gone with google Firebase, i have created all the dependencies for firebase and downloaded google.services.json . And i have added listener in index.js file (refered this link) also, no problem upto this. In the firebase Document, asked to add these lines at app level build grade
compile 'com.google.firebase:firebase-core:11.8.0'
apply plugin: 'com.google.gms.google-services'
and this at buildscript classpath 'com.google.gms:google-services:3.0.0'
After adding this am using command cordova build android , it throws error. Am not sure what is wrong
Note :
Also tried without adding the above line, in that case, build gets success but the notification is not working.
You can refer to the official phonegap plugin here. This would give you a fair idea on how to do or alternatively if it meets your use case you can directly use it.
Cordova is a free version of phone-gap so compatibility will not be an issue.
I finally managed to get google app invites working in my app. I enabled them on the developer console and followed this guide. The following steps were giving me problems:
Add the dependency to your project's top-level build.gradle:
classpath 'com.google.gms:google-services:1.3.0-beta1'
Add the plugin to your app-level build.gradle:
apply plugin: 'com.google.gms.google-services'
Copy the google-services.json file you just downloaded into the app/ or mobile/ directory of your Android Studio project.
By adding that classpath I had to use jcenter as my repository, as this package isn't available at mavenCentral. However, even if I built the project with jcenter as a repository, the gradle build failed with an empty error message. I tried to debug the problem but the stacktrace for the crash was enormous.
My solution was to simply ignore these steps. The app invites are working flawlessly since then.
With this in mind, here goes my question. Why were all these steps listed on the official google guide if they are not necessary? Am I missing something here?
When I started official sample for Invite API yesterday, I had problem but just because of version of google-services (1st step -> add the dependency of your project's top-level build.gradle), so I have to change it to the latest version:
classpath 'com.android.tools.build:gradle:1.3.0-beta4'
classpath 'com.google.gms:google-services:1.3.0-beta4'
and this solves all problems. I don't understand your question, which step you exactly skipped of these 3 steps mentioned and made invite api functional?
Finally found the answer. The service was working on my prototype because it doesn't check for credentials on the test device. Once released to public, the keys are needed for the service to work correctly as Ituoke Ajanlekoko said in the comments.
Further information can be found at this topic:
What does google-services.json really do?
I saw all other questions, but none of accepted answers is working for me.
By following integration steps found here https://dev.twitter.com/twitter-kit/android/integrate I have created crashlytics.properties file in module root. File is filled with apiKey and apiSecret values found in my newly created twitter application.
Error occurr on project build. I am using AndroidStudio 1.0
This is my error:
ERROR - Crashlytics Developer Tools error.
java.lang.IllegalArgumentException: Crashlytics found an invalid API key: REAL_APIKEY_VALUE.
Check the Crashlytics plugin to make sure that the application has been added successfully!
Contact support#fabric.io for assistance.
You just forgot to add one line, in app-level gradle file.
apply plugin: 'com.google.gms.google-services'
this happens because when you are adding firebase:crashlytics, firebase document not have this line. so you need to add it manually. see this is firebase:crashlytics document photo.
This happened to me when I updated Android Studio from 3.2 to 3.3, to fix it I just updated the
classpath 'com.google.gms:google-services:4.1.0'
to
classpath 'com.google.gms:google-services:4.2.0'
And it worked again
Works fine added this on fabric.properties like this:
# Fabric properties file: app/fabric.properties
apiSecret=xx68f6074dxxxxxc11dxxx97c172e8ebf0
apiKey=xxxe76c4xxxx97e8cxxxx0135e9d46f5a2xxx
Add on .gitignore (for open source projects)
REMOVE entry on AndroidManifest.xml:
<meta-data
android:name="io.fabric.ApiKey"
android:value="xxx6c41xxx6ec601xxxd4xxxa2" />
Oficial documentation: https://docs.fabric.io/android/fabric/settings/working-in-teams.html
I also experienced this issue and it took a while for me to realize I forgot adding the following line into the app/build.gradle:
apply plugin: 'com.google.gms.google-services'
After adding it, it started working like a charm even without <meta-data> in manifest and/or app/fabric.properties file.
Add the below line in app/build.gradle file
apply plugin: 'com.google.gms.google-services'
Clean The Project and Run.
after adding file fabric.properties, getting error as below.
Crashlytics found an invalid API key: null.
Check the Crashlytics plugin to make sure that the application has been
added successfully!
Contact support#fabric.io for assistance.
We need to register app and verify SHA-1 for same.
Add firebase: add google-services.json file from firebase console to your /app folder of your application.(follow steps given by Firebase Console-> Add Firebase to your Android app )
It's not giving error now
<meta-data android:name="com.crashlytics.ApiKey"
android:value="YOUR_API_KEY"/>
Add this one on Android manifest.xml
here you get the api key
https://www.fabric.io/kits/android/crashlytics/install
If someone is using crashlytics with Android dynamic features module, make sure your fabric and google-services plugins are applied only in your app module. In my case that was the problem.
Changing the below dependency at project build.gradle from :
classpath "com.google.gms:google-services:4.1.0"
to
classpath "com.google.gms:google-services:4.2.0"
has solved the problem for me.