I'm trying to migrate Crashlytics 2.6.7 -> 2.8.0 and Crashlytics NDK 1.1.6 -> 2.0.1
But I encountered the issue that each time my app is restarted after native crash, Crashlytics writes to logcat something like this:
12-18 19:48:33.499 11678-11717/? W/CrashlyticsCore: No minidump data found in directory /data/data/com.example.app/files/.Fabric/com.crashlytics.sdk.android.crashlytics-ndk/native/1513601249792
and I don't see any info about the crash in my dashboard. At the same time, Java crashes are successfully logged and appear in the dashboard.
My build.gradle:
apply plugin: 'io.fabric'
crashlytics {
enableNdk true
}
dependencies {
compile('com.crashlytics.sdk.android:crashlytics:2.8.0#aar') {
transitive = true;
}
compile('com.crashlytics.sdk.android:crashlytics-ndk:2.0.1#aar') {
transitive = true
}
}
The C++ code I'm using for test (there is SIGSEGV should be thrown):
if(_stream)
{
delete _stream;
_stream->close();
_stream=NULL;
}
What I need to change to make it work?
Related
I am getting this error message, which seems to be in relation with R8 minifying. It works with the debug build with minify enabled, which is weird. But I am getting it definitely in the release build type and when downloading the app from the Play Store. Also when building on the CI, so cache or something like that cannot really be a problem, it worked before.
2021-03-30 14:51:56.495 11289-11289/? E/FirebaseCrashlytics: Error handling uncaught exception
java.util.concurrent.TimeoutException
at planner.n63.a(Utils.java:13)
at planner.v00.a(CrashlyticsController.java:10)
at planner.y10.uncaughtException(CrashlyticsUncaughtExceptionHandler.java:4)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1073)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
at java.lang.Thread.dispatchUncaughtException(Thread.java:2203)
// build.gradle :project
buildscript {
dependencies {
...
classpath Libs.Google.gmsGoogleServices
classpath Libs.Google.Firebase.crashlyticsGradlePlugin
}
}
// build.gradle :app
android {
...
buildTypes {
...
release {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
minifyEnabled true
}
}
}
dependencies {
...
implementation platform(Libs.Google.Firebase.bom)
implementation Libs.Google.Firebase.analytics
implementation Libs.Google.Firebase.crashlytics
}
// Must be applied after dependencies
if (file("google-services.json").exists()) {
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
}
class App : Application() {
override fun onCreate() {
super.onCreate()
FirebaseApp.initializeApp(this)
}
}
Low Internet connectivity (bad internet)
this occurs if the device doesn't have a good internet connection.
that is what happened in my case. try to simulate bad internet on your emulator.
I have a some problem.
In my case I have many buildFlavors and buildVariants. I think Android Stuido cache my old project structure and all google-services.json files not put into apk. Clean project help me.
You can see Logs with "FirebaseCrashlytics" key and find out real firebase project who chained with uor
Before this gets marked as a duplicate, I have tried everything from all the possible questions.
Java crashes are reported properly, however crashes from the native libs don't have the debug symbols.
What i've tried:
./gradlew crashlyticsUploadSymbolsDevDebug // to upload the symbols manually
androidNdkOut 'build/intermediates/ndkBuild/devDebug/obj/local' //specify the ndk paths manually
androidNdkLibsOut 'build/intermediates/merged_native_libs/devDebug/out/lib'` //specify the ndk paths manually
The current setup:
Dependencies:
implementation('com.crashlytics.sdk.android:crashlytics:2.10.1#aar') { transitive = true }
implementation 'com.crashlytics.sdk.android:crashlytics-ndk:2.1.1'
android.applicationVariants.all { variant ->
def variantName = variant.name.capitalize()
def task = task("ndkbuild${variantName}")
task.finalizedBy("crashlyticsUploadSymbols${variantName}")
}
crashlytics {
enableNdk true
manifestPath 'AndroidManifest.xml'
androidNdkOut 'build/intermediates/ndkBuild/devDebug/obj/local'
androidNdkLibsOut 'build/intermediates/merged_native_libs/devDebug/out/lib'
}
The fabric dependencies:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
// The Fabric Gradle plugin uses an open ended version to react
// quickly to Android tooling updates
classpath 'io.fabric.tools:gradle:1.31.2'
}
}
Fabric is setup and working with the Java layer crashes.
Fabric.Builder builder = new Fabric.Builder(this).kits(new Crashlytics(), new
CrashlyticsNdk());`
The problem: Native crashes get reported but the debug symbols are missing, there are no error/outputs that indicate why they're missing.
I made a sample app in order to be able to reproduce this more easily.
All you have to do is create a project in firebase and paste the google-services.json file and build.
Link to the repo
This might be caused by debug symbols in another module or because of an outdated configuration.
Try to configure it alike this:
crashlytics {
enableNdk true
// If using the Android plugin for Gradle version 2.2.0+ with the externalNativeBuild DSL,
// you should remove the androidNdkOut and androidNdkLibsOut properties, as these paths will
// automatically be detected by the Fabric plugin.
androidNdkOut 'obj'
androidNdkLibsOut 'libs'
manifestPath 'AndroidManifest.xml'
}
However, you should better migrate to Firebase Crashlytics, because Fabric will shut it down soon:
Crashlytics has been integrated into Firebase, with new Firebase-only features. New apps should use Crashlytics in Firebase to get access to the latest updates and features. Fabric Crashlytics and the Fabric dashboard will be available until March 31, 2020 for existing users.
We have programming an Android app and try to implement Crashlytics to our app.
We have different types of problem .
Version we used :
Android studio version :
3.3
Gradle version :
classpath 'com.android.tools.build:gradle:3.3.1'
Plugin :
Fabric for Android studio v4.3.0
Implementation :
implementation('com.crashlytics.sdk.android:crashlytics:2.9.9') { transitive = true }
implementation('io.fabric.sdk.android:fabric:1.4.0#aar') { transitive = true }
gradle-wrapper.properties :
distributionUrl=https://services.gradle.org/distributions/gradle-5.2.1-all.zip
First Problem :
When we implement Crashlytics, you know that developers have 3 steps. We can not skip 2,3.steps. Because we have not compiled our application yet. We had two main errors:
Error 1:
This app relies on Crashlytics. Please sign up for access at https://fabric.io/sign_up,
Error 2 :
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.
So, we had to be disabled "Debug Mod" to complete implementation of Crashlytic.
Crashlytics crashlyticsKit = new Crashlytics.Builder()
.core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build())
.build();
Fabric.with(this, crashlyticsKit); // Tod from Fabric suggested in stackoverflow
And implementation was completed.
But we do not want to do that. Because, when we have a crash, it does not any report to Crashlytics or Firebase. We also want to have debug mod’s crashes.
When we removed -> ....disabled(BuildConfig.DEBUG) - it shows again : Error 1, Error 2.
Second Problem :
In gradle ; apply plugin : ‘io.fabric’, we made the comment line, when we remove comments line, we have errors below :
Error 3 :
WARNING: API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getExternalNativeBuildTasks(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
Affected Modules: app
When we searched it, this error related to new android studio gradle. So we needed to make comment line “apply plugin: fabric.io” again.
There is no good solution about that.
To run application we can not remove:
new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build() : (due to Error1 Error2)
So we try to enable report different ways :
What have we try to add until here?
1. Enable in gradle :
buildTypes {
debug {
manifestPlaceholders = [crashlyticsEnabled: true]
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
manifestPlaceholders = [crashlyticsEnabled: false]
}
2. Enable in Manifest
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="true" />
3.Enable in ADB
adb shell setprop log.tag.Fabric DEBUG
adb shell setprop log.tag.CrashlyticsCore DEBUG
But still, Crashlytics or Firebase does not get any Debug Crash reports.
We have expecting your solutions.
I managed to get this fixed without adding android.debug.obsoleteApi=true in gradle.properties.
I basically connected 3 flavors to different Firebase projects using proper flavor configuration and the provided google-services.json file.
What your gradle file is missing comparing it to mine is this:
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "com.google.gms:google-services:$google_services_version" // google-services plugin
classpath "io.fabric.tools:gradle:$fabric_tools_version"
}
apply plugin: "io.fabric"
And finally: implementation "com.google.firebase:firebase-crash:16.2.1"
I know Fabric is going to shut down this year, but by running the apps this way, they connected to the Firebase console with no problem whatsoever.
Regarding the flavor configuration, I downloaded three different json files (I have 3 flavors) and added them in the root directory of each flavor. For example:
flavor1:
assets
java
res
AndroidManifest
google-services.json (for flavor1)
flavor2:
assets
java
res
AndroidManifest
google-services.json (for flavor2)
And that's it. Hope this helps someone.
EDIT
So, as you guys may already know, Fabric is shutting down and Firebase Crashlytics is ready, making this answer deprecated.
Please check here so you can successfully update your app and avoid weird behaviors.
This also happens if you set ext.enableCrashlytics = false for a build variant but still try to call Fabric.with(context, Crashlytics()) in your app initialization code. ext.enableCrashlytics = false disables the build plugin (an optimization I made to make my debug builds faster) but then of course the build ID will be missing.
Today I migrated from Fabric Crashlytics to Firebase Crashlytics and encountered a fatal error that didn't keep me going. What I did was this:
In app-> build.gradle:
apply plugin: 'io.fabric'
dependencies {
implementation "com.google.firebase:firebase-core:17.2.0"
// Add dependency
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
}
In general build.gradle:
buildscript {
repositories {
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'io.fabric.tools:gradle:1.31.2' // Crashlytics plugin
}
And of course download the json file from Firebase and insert it in the app folder.
After completing these simple steps, I received this error when I started the application
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.
I went to check that there wasn't any code that could call up old Fabric methods, and in fact I discovered that in app-> build.gradle I had this:
buildTypes {
debug {
minifyEnabled false
debuggable true
**ext.enableCrashlytics = false**
ext.alwaysUpdateBuildId = false
}
}
ext.enableCrashlytics = false certainly it was a method that referred to the old Fabric, so I removed this line and everything worked perfectly! I hope to help someone with this
just set apply plugin: 'io.fabric' in ur build.gradle (app)
In my case I was missing Crashlytics plugin:
apply plugin: 'com.google.firebase.crashlytics'
Put that line at the top of your module's build.gradle file e.g.
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.crashlytics'
I faced the same issue when migrating from Fabric Crashlytics to Firebase Crashlytics, following steps fixed the issue for me
Clean your project
Update google-services.json file
Just add this line in your build.gradle (Project):
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
and this plugin in your build Gradle (app):
apply plugin: 'com.google.firebase.crashlytics'
I had the same problem in my app (Android Studio 3.4.1)
I fixed trough conecting to the Fabric Plugin. Creating an account and linking my app to it.
In my case i just update implementation 'com.google.firebase:firebase-core:16.0.9' to implementation 'com.google.firebase:firebase-core:17.0.1'
and added apply plugin: 'io.fabric' to my app level gradle. This solved Error 2 for me.
if you migrate from Fabric to Firebase please ensure you've called:
FirebaseApp.initializeApp(this)
in your Application onCreate().
No need any relation to Fabric anymore, just follow this guidance:
https://firebase.google.com/docs/crashlytics/get-started?platform=android
In My case, I hade two modules that used a different version of FireBase Crashlytics.
In My case, I miss this line: apply plugin: 'com.google.gms.google-services'
For reference, https://rnfirebase.io/crashlytics/android-setup
I had the same problem here and I fixed it by adding Fabric to Gradle
Here's my project Gradle file:
google()
jcenter()
maven { url 'https://jitpack.io' }
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
My Crashlytics data is not appearing in the Firebase Crashlytics view. It does show "Crash-free statistics" as being 75%, so it appears to be recording some data. I also see the crashes appearing instantly both in Fabric and in the old Firebase Crash Reporting interface, as well as in the DebugView as general events but nothing in the Issues section of the Crashlytics page. I thought that perhaps my Fabric project had not been linked to my Firebase project, but when I tried doing it manually using this link https://www.fabric.io/firebase_migration/apps it tells me the projects are already linked, specifically it says Project already contains a linked app with that bundle ID and platform. Every time I open my app in Android studio I immediately run the command adb shell setprop debug.firebase.analytics.app ie.moses.keepitlocal so that my events will appear in the DebugView, perhaps this could be affecting it, but I doubt it.
Here is my project build.gradle file:
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:3.3.0'
classpath 'io.fabric.tools:gradle:1.25.4'
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and this is the build.gradle for my specific app module
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
def supportLibraryVersion = '27.1.1'
android {
compileSdkVersion 27
defaultConfig {
applicationId "ie.moses.keepitlocal"
minSdkVersion 16
targetSdkVersion 27
versionCode 5
versionName "0.3.1-alpha"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
buildConfigField 'boolean', 'CRASHLYTICS', 'true'
}
release {
buildConfigField 'boolean', 'CRASHLYTICS', 'true'
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'com.android.support') {
// Used to prevent conflicting versions of Android support library
// contained in other dependencies (e.g. all the firebase dependencies)
details.useVersion supportLibraryVersion
}
}
}
dependencies {
implementation files('libs/YouTubeAndroidPlayerApi.jar')
implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
implementation "com.android.support:recyclerview-v7:$supportLibraryVersion"
implementation "com.android.support:cardview-v7:$supportLibraryVersion"
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-crash:16.2.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.github.bumptech.glide:glide:4.7.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
implementation 'com.google.guava:guava:26.0-android'
}
apply plugin: 'com.google.gms.google-services'
I am using a Button to force a crash with the following code (as I mentioned, these crashes appear almost immediately in Fabric and in the old Crash Reporting interface which has been deprecated and will be removed in 2 days!). Here is the code for the crash button:
Button crashButton = new Button(this);
crashButton.setText("Crash!");
crashButton.setOnClickListener(view -> {
throw new IllegalStateException("you hit the crash button!");
});
addContentView(crashButton, new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
EDIT
I have just noticed that on the firebase transition status page it says "0/1 APP LINKED" and "NO PROJECTS YET".
I also need to reinstall the Crashlytics library from the Fabric plugin every time I open Android studio. The dependencies already exist in my gradle file but the plugin does not seem to recognise them.
EDIT
I am now trying to unlink fabric and firebase so I can try linking them again from fresh. I came across this question Unlink an existing firebase app?, but fabric is not even listed as an integration in my project.
Forget Fabric, it's not required. Just follow instructions in your Firebase console and Firebase documentation: https://firebase.google.com/docs/crashlytics/get-started#android
Don't mess with Fabric console, you should completly remove any calls to Fabric console and configure your project from scratch as Firebase doc says. As soon as you run app correctly configured, you will see Crashlytics panel in your Firebase console
The only solution I could find was as follows (I am including all steps exactly as I carried them out even if they may not be relevant):
I exported my realtime database to JSON and made a copy of my database rules.
I deleted my app from the Firebase project.
I deleted the Firebase project.
I deleted my project from Fabric.
I removed all references to Fabric, Crashlytics and the old Firebase Crash Reporting library from my project, this consisted of removing the dependencies from both my build.gradle files and deleting the fabric.properties file.
I ran gradlew.bat clean (I'm on Windows) on my project from the command line.
I did a Ctrl+Shift+F (search all project files) for the words fabric and crash just to make sure there was absolutely no remaining references to Fabric, Crashlytics or the deprecated Crash Reporting library (which was still a dependency in my build.gradle without me realising it because Firebase assistant tool added that as the crash reporting dependency when I first tried to get this working and then immediately told me it was deprecated :/ ).
I searched in File Explorer on windows for any files referencing "Fabric" or "Crash" (there weren't any).
I created a new project on Firebase.
I imported my realtime database from the previously exported JSON file and copy/pasted back in my rules.
I recreated my one test user account (thankfully the app is not yet in production :p).
I reenabled analytics (although this was simply a matter of going to the Analytics tab and seeing that it was already enabled as I still had the dependency in my build.gradle for my app module).
I went to the Crashlytics tab and saw the original screen explaining how to enable Crashlytics. This time however I did not create the project on Fabric or install the Fabric plugin, I only copied in the Fabric dependencies as I think #jake was suggesting, these can be found here https://firebase.google.com/docs/crashlytics/get-started?authuser=0.
I then tried to produce a crash using the method described here https://firebase.google.com/docs/crashlytics/force-a-crash?authuser=0.
And then voilà! The crash appeared immediately in the Crashlytics tab of Firebase. No Fabric project, no Fabric plugin, just the dependencies.
This method had the added benefit of allowing me to be rid of extra databases and user properties I did not want (which Firebase does not currently allow you to remove once you create them >:( ), but this method obviously may not be feasible for anyone who already has a lot invested in their Firebase project and cannot simply start over. Luckily for me this was not too much of a pain.
add apply plugin: 'com.google.firebase.crashlytics' in app module
and dependencies {
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1'
classpath 'com.google.gms:google-services:4.3.3'
} in project module
I had the same issue as you. I was able to link Fabric to Firebase after unlinking Crashlytics from Firebase following the instructions from this answer. Sadly this could only be done with building a custom url myself.
I am trying to configure fabric NDK bug reporting. I used instructions provided by fabric.
I added NDK dependency to my cradle file.
dependencies {
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.6#aar') {
transitive = true;
}
}
crashlytics {
enableNdk true
// according to documentation if I use grade plugin 2.2+ (I use 2.3.3) I can commit setting androidNdkOut and androidNdkLibsOut
}
I compile project using this command
./gradlew crashlyticsUploadSymbolsRelease
But all my crash reports look like this one:
Crashed: part.of.my.package.name|
0 ??? 0x0 (Missing)
Does anyone know how to correctly setup crashlytics NDK?
Thank you.