Firebase crashlytics doesnt show crashes












0















Wanted to get a crash report from firebase once the app gets crashed. Is it possible to get debug mode logs separate and production crash log separate in firebase crash?...because its not really clear when we get crash from production or debug test.
Also, firebase won't reflect crash report on the console after a crash happens.
What should I do to get up to date crash report?
Is there another way to get a crash report other than firebase?
I have updated the libraries which required for the firebase crashlytics.
and Followed tutorial - https://firebase.google.com/docs/crashlytics/get-started#android










share|improve this question

























  • firebase takes 24h to show the crash reports.

    – Urvish rana
    Jan 2 at 6:11











  • Thanks for your quick replay, But I didn't get crash after 24h.In that case, what should I do?

    – Meera Potdar
    Jan 2 at 6:13








  • 1





    @Urvishrana, I think that's not true, in my case, the crashes were updating in 5 mins

    – Zlytherin
    Jan 2 at 6:13








  • 1





    yes @Zlytherin usually it reflects within some minuts.

    – Rumit Patel
    Jan 2 at 6:14






  • 1





    @MeeraPotdar follow this firebase.google.com/docs/crashlytics/get-started#android

    – Urvish rana
    Jan 2 at 6:21
















0















Wanted to get a crash report from firebase once the app gets crashed. Is it possible to get debug mode logs separate and production crash log separate in firebase crash?...because its not really clear when we get crash from production or debug test.
Also, firebase won't reflect crash report on the console after a crash happens.
What should I do to get up to date crash report?
Is there another way to get a crash report other than firebase?
I have updated the libraries which required for the firebase crashlytics.
and Followed tutorial - https://firebase.google.com/docs/crashlytics/get-started#android










share|improve this question

























  • firebase takes 24h to show the crash reports.

    – Urvish rana
    Jan 2 at 6:11











  • Thanks for your quick replay, But I didn't get crash after 24h.In that case, what should I do?

    – Meera Potdar
    Jan 2 at 6:13








  • 1





    @Urvishrana, I think that's not true, in my case, the crashes were updating in 5 mins

    – Zlytherin
    Jan 2 at 6:13








  • 1





    yes @Zlytherin usually it reflects within some minuts.

    – Rumit Patel
    Jan 2 at 6:14






  • 1





    @MeeraPotdar follow this firebase.google.com/docs/crashlytics/get-started#android

    – Urvish rana
    Jan 2 at 6:21














0












0








0


0






Wanted to get a crash report from firebase once the app gets crashed. Is it possible to get debug mode logs separate and production crash log separate in firebase crash?...because its not really clear when we get crash from production or debug test.
Also, firebase won't reflect crash report on the console after a crash happens.
What should I do to get up to date crash report?
Is there another way to get a crash report other than firebase?
I have updated the libraries which required for the firebase crashlytics.
and Followed tutorial - https://firebase.google.com/docs/crashlytics/get-started#android










share|improve this question
















Wanted to get a crash report from firebase once the app gets crashed. Is it possible to get debug mode logs separate and production crash log separate in firebase crash?...because its not really clear when we get crash from production or debug test.
Also, firebase won't reflect crash report on the console after a crash happens.
What should I do to get up to date crash report?
Is there another way to get a crash report other than firebase?
I have updated the libraries which required for the firebase crashlytics.
and Followed tutorial - https://firebase.google.com/docs/crashlytics/get-started#android







android firebase crashlytics crashlytics-android






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 2 at 8:45









Dennis Alund

7451418




7451418










asked Jan 2 at 6:09









Meera PotdarMeera Potdar

12




12













  • firebase takes 24h to show the crash reports.

    – Urvish rana
    Jan 2 at 6:11











  • Thanks for your quick replay, But I didn't get crash after 24h.In that case, what should I do?

    – Meera Potdar
    Jan 2 at 6:13








  • 1





    @Urvishrana, I think that's not true, in my case, the crashes were updating in 5 mins

    – Zlytherin
    Jan 2 at 6:13








  • 1





    yes @Zlytherin usually it reflects within some minuts.

    – Rumit Patel
    Jan 2 at 6:14






  • 1





    @MeeraPotdar follow this firebase.google.com/docs/crashlytics/get-started#android

    – Urvish rana
    Jan 2 at 6:21



















  • firebase takes 24h to show the crash reports.

    – Urvish rana
    Jan 2 at 6:11











  • Thanks for your quick replay, But I didn't get crash after 24h.In that case, what should I do?

    – Meera Potdar
    Jan 2 at 6:13








  • 1





    @Urvishrana, I think that's not true, in my case, the crashes were updating in 5 mins

    – Zlytherin
    Jan 2 at 6:13








  • 1





    yes @Zlytherin usually it reflects within some minuts.

    – Rumit Patel
    Jan 2 at 6:14






  • 1





    @MeeraPotdar follow this firebase.google.com/docs/crashlytics/get-started#android

    – Urvish rana
    Jan 2 at 6:21

















firebase takes 24h to show the crash reports.

– Urvish rana
Jan 2 at 6:11





firebase takes 24h to show the crash reports.

– Urvish rana
Jan 2 at 6:11













Thanks for your quick replay, But I didn't get crash after 24h.In that case, what should I do?

– Meera Potdar
Jan 2 at 6:13







Thanks for your quick replay, But I didn't get crash after 24h.In that case, what should I do?

– Meera Potdar
Jan 2 at 6:13






1




1





@Urvishrana, I think that's not true, in my case, the crashes were updating in 5 mins

– Zlytherin
Jan 2 at 6:13







@Urvishrana, I think that's not true, in my case, the crashes were updating in 5 mins

– Zlytherin
Jan 2 at 6:13






1




1





yes @Zlytherin usually it reflects within some minuts.

– Rumit Patel
Jan 2 at 6:14





yes @Zlytherin usually it reflects within some minuts.

– Rumit Patel
Jan 2 at 6:14




1




1





@MeeraPotdar follow this firebase.google.com/docs/crashlytics/get-started#android

– Urvish rana
Jan 2 at 6:21





@MeeraPotdar follow this firebase.google.com/docs/crashlytics/get-started#android

– Urvish rana
Jan 2 at 6:21












2 Answers
2






active

oldest

votes


















0















Is it possible to get debug mode logs separate and production crash log separate in firebase crash?




It's common practice or perhaps even recommended that you create a separate project for testing and production. Download and place the google-services.json in your build flavor folder




  • ~/app/src/release/google-services.json

  • ~/app/src/debug/google-services.json


Even if you are only having a single Firebase project for test and production, you can filter your logs by the application id if you're setting up a project id suffix for the development build flavor:



~/app/build.gradle



buildTypes {
release {
}
debug {
applicationIdSuffix '.debug'
versionNameSuffix '-dbg'
}
}


Here you can see the different flavors being available in Crashlytics



enter image description here




Also, firebase won't reflect crash report on the console after a crash happens.




First time that you set up crashlytics it might take some time before the data shows up in the dashboard. But if it's been over 24 hours, it's likely that it's not properly set up. Try to explicitly trigger a crash to make sure that it works fine.



Button crashButton = new Button(this);
crashButton.setText("Crash!");
crashButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Crashlytics.getInstance().crash(); // Force a crash
}
});



Is there another way to get a crash report other than firebase?




Yes you can have more than one crash reporting tool if you have the need. You can perhaps create a wrapper class for crash reporting where you abstract the call to Crashlytics and you can add or change the underlying reporting platform there.






share|improve this answer



















  • 1





    Thank you for your guidance. I would like to implement your solution and let you know If any help required.

    – Meera Potdar
    Jan 2 at 7:27











  • Can you please explain to me How to make multiple google-services.json files of the same project? I made two flavors internal and production, So I need to create two google-services.json files according to application Ids. Do I need to create two different projects on firebase?

    – Meera Potdar
    Jan 3 at 7:12













  • You get one google-services.json for each app that you add to Firebase. So the same way you added the first app to Firebase, you repeat for the flavor with the applicationIdSuffix. It's the same procedure whether you are having two separate Firebase projects or if you're adding both flavors to the same project.

    – Dennis Alund
    Jan 3 at 8:07











  • I create a new project on firebase to get a new google-service.json file.

    – Meera Potdar
    Jan 4 at 4:32











  • Yes, please see the documentation for how to set it up.

    – Dennis Alund
    Jan 7 at 7:52



















0














Firebase will not differentiate between debug and production versions logs/crashes in crashlytics if you have set auto collection of logs. You can use a logging library to only send logs and crashes if the app build.gradle has debug:fasle i.e. production.
You can look at the Timber logging library which has a great example of adding crash reporting. https://github.com/JakeWharton/timber



You have to disable the auto initialization of crashlytics in manifest to have control when crashes are sent to firebase



<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="false" />


Then in your Application class's onCreate you check if BuildConfig.DEBUG is true you will not initialize crashlaytics so your debug logs and exceptions will not go to firebase, resulting in only production crashes.



For timber when you want to put logs and crashes to firebase you can use this Tree:



/**
* {@link Timber.Tree} using {@link Crashlytics} as crash reporting
*/
private static class CrashReportingTree extends Timber.Tree {

CrashReportingTree(Context context) {
CrashlyticsCore core = new CrashlyticsCore.Builder()
.disabled(BuildConfig.DEBUG)
.build();
Fabric.with(context, new Crashlytics.Builder().core(core).build());
}

@Override
protected void log(int priority, String tag, @NonNull String message, Throwable t) {
// don't report log to Crashlytics if priority is Verbose or Debug
if (priority == Log.VERBOSE || priority == Log.DEBUG) {
return;
}
Crashlytics.log(priority, tag, message);

if (t != null) {
if (priority == Log.ERROR) {
Crashlytics.logException(t);
}
}

}
}


For debug mode you should not send crashes to firebase as you can check the debug logs locally.






share|improve this answer
























  • Thank you so much for your brief description. I would like to check first, It is working properly for me or not. Let you know If I need any help.

    – Meera Potdar
    Jan 2 at 7:22











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54001966%2ffirebase-crashlytics-doesnt-show-crashes%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0















Is it possible to get debug mode logs separate and production crash log separate in firebase crash?




It's common practice or perhaps even recommended that you create a separate project for testing and production. Download and place the google-services.json in your build flavor folder




  • ~/app/src/release/google-services.json

  • ~/app/src/debug/google-services.json


Even if you are only having a single Firebase project for test and production, you can filter your logs by the application id if you're setting up a project id suffix for the development build flavor:



~/app/build.gradle



buildTypes {
release {
}
debug {
applicationIdSuffix '.debug'
versionNameSuffix '-dbg'
}
}


Here you can see the different flavors being available in Crashlytics



enter image description here




Also, firebase won't reflect crash report on the console after a crash happens.




First time that you set up crashlytics it might take some time before the data shows up in the dashboard. But if it's been over 24 hours, it's likely that it's not properly set up. Try to explicitly trigger a crash to make sure that it works fine.



Button crashButton = new Button(this);
crashButton.setText("Crash!");
crashButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Crashlytics.getInstance().crash(); // Force a crash
}
});



Is there another way to get a crash report other than firebase?




Yes you can have more than one crash reporting tool if you have the need. You can perhaps create a wrapper class for crash reporting where you abstract the call to Crashlytics and you can add or change the underlying reporting platform there.






share|improve this answer



















  • 1





    Thank you for your guidance. I would like to implement your solution and let you know If any help required.

    – Meera Potdar
    Jan 2 at 7:27











  • Can you please explain to me How to make multiple google-services.json files of the same project? I made two flavors internal and production, So I need to create two google-services.json files according to application Ids. Do I need to create two different projects on firebase?

    – Meera Potdar
    Jan 3 at 7:12













  • You get one google-services.json for each app that you add to Firebase. So the same way you added the first app to Firebase, you repeat for the flavor with the applicationIdSuffix. It's the same procedure whether you are having two separate Firebase projects or if you're adding both flavors to the same project.

    – Dennis Alund
    Jan 3 at 8:07











  • I create a new project on firebase to get a new google-service.json file.

    – Meera Potdar
    Jan 4 at 4:32











  • Yes, please see the documentation for how to set it up.

    – Dennis Alund
    Jan 7 at 7:52
















0















Is it possible to get debug mode logs separate and production crash log separate in firebase crash?




It's common practice or perhaps even recommended that you create a separate project for testing and production. Download and place the google-services.json in your build flavor folder




  • ~/app/src/release/google-services.json

  • ~/app/src/debug/google-services.json


Even if you are only having a single Firebase project for test and production, you can filter your logs by the application id if you're setting up a project id suffix for the development build flavor:



~/app/build.gradle



buildTypes {
release {
}
debug {
applicationIdSuffix '.debug'
versionNameSuffix '-dbg'
}
}


Here you can see the different flavors being available in Crashlytics



enter image description here




Also, firebase won't reflect crash report on the console after a crash happens.




First time that you set up crashlytics it might take some time before the data shows up in the dashboard. But if it's been over 24 hours, it's likely that it's not properly set up. Try to explicitly trigger a crash to make sure that it works fine.



Button crashButton = new Button(this);
crashButton.setText("Crash!");
crashButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Crashlytics.getInstance().crash(); // Force a crash
}
});



Is there another way to get a crash report other than firebase?




Yes you can have more than one crash reporting tool if you have the need. You can perhaps create a wrapper class for crash reporting where you abstract the call to Crashlytics and you can add or change the underlying reporting platform there.






share|improve this answer



















  • 1





    Thank you for your guidance. I would like to implement your solution and let you know If any help required.

    – Meera Potdar
    Jan 2 at 7:27











  • Can you please explain to me How to make multiple google-services.json files of the same project? I made two flavors internal and production, So I need to create two google-services.json files according to application Ids. Do I need to create two different projects on firebase?

    – Meera Potdar
    Jan 3 at 7:12













  • You get one google-services.json for each app that you add to Firebase. So the same way you added the first app to Firebase, you repeat for the flavor with the applicationIdSuffix. It's the same procedure whether you are having two separate Firebase projects or if you're adding both flavors to the same project.

    – Dennis Alund
    Jan 3 at 8:07











  • I create a new project on firebase to get a new google-service.json file.

    – Meera Potdar
    Jan 4 at 4:32











  • Yes, please see the documentation for how to set it up.

    – Dennis Alund
    Jan 7 at 7:52














0












0








0








Is it possible to get debug mode logs separate and production crash log separate in firebase crash?




It's common practice or perhaps even recommended that you create a separate project for testing and production. Download and place the google-services.json in your build flavor folder




  • ~/app/src/release/google-services.json

  • ~/app/src/debug/google-services.json


Even if you are only having a single Firebase project for test and production, you can filter your logs by the application id if you're setting up a project id suffix for the development build flavor:



~/app/build.gradle



buildTypes {
release {
}
debug {
applicationIdSuffix '.debug'
versionNameSuffix '-dbg'
}
}


Here you can see the different flavors being available in Crashlytics



enter image description here




Also, firebase won't reflect crash report on the console after a crash happens.




First time that you set up crashlytics it might take some time before the data shows up in the dashboard. But if it's been over 24 hours, it's likely that it's not properly set up. Try to explicitly trigger a crash to make sure that it works fine.



Button crashButton = new Button(this);
crashButton.setText("Crash!");
crashButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Crashlytics.getInstance().crash(); // Force a crash
}
});



Is there another way to get a crash report other than firebase?




Yes you can have more than one crash reporting tool if you have the need. You can perhaps create a wrapper class for crash reporting where you abstract the call to Crashlytics and you can add or change the underlying reporting platform there.






share|improve this answer














Is it possible to get debug mode logs separate and production crash log separate in firebase crash?




It's common practice or perhaps even recommended that you create a separate project for testing and production. Download and place the google-services.json in your build flavor folder




  • ~/app/src/release/google-services.json

  • ~/app/src/debug/google-services.json


Even if you are only having a single Firebase project for test and production, you can filter your logs by the application id if you're setting up a project id suffix for the development build flavor:



~/app/build.gradle



buildTypes {
release {
}
debug {
applicationIdSuffix '.debug'
versionNameSuffix '-dbg'
}
}


Here you can see the different flavors being available in Crashlytics



enter image description here




Also, firebase won't reflect crash report on the console after a crash happens.




First time that you set up crashlytics it might take some time before the data shows up in the dashboard. But if it's been over 24 hours, it's likely that it's not properly set up. Try to explicitly trigger a crash to make sure that it works fine.



Button crashButton = new Button(this);
crashButton.setText("Crash!");
crashButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Crashlytics.getInstance().crash(); // Force a crash
}
});



Is there another way to get a crash report other than firebase?




Yes you can have more than one crash reporting tool if you have the need. You can perhaps create a wrapper class for crash reporting where you abstract the call to Crashlytics and you can add or change the underlying reporting platform there.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 2 at 6:58









Dennis AlundDennis Alund

7451418




7451418








  • 1





    Thank you for your guidance. I would like to implement your solution and let you know If any help required.

    – Meera Potdar
    Jan 2 at 7:27











  • Can you please explain to me How to make multiple google-services.json files of the same project? I made two flavors internal and production, So I need to create two google-services.json files according to application Ids. Do I need to create two different projects on firebase?

    – Meera Potdar
    Jan 3 at 7:12













  • You get one google-services.json for each app that you add to Firebase. So the same way you added the first app to Firebase, you repeat for the flavor with the applicationIdSuffix. It's the same procedure whether you are having two separate Firebase projects or if you're adding both flavors to the same project.

    – Dennis Alund
    Jan 3 at 8:07











  • I create a new project on firebase to get a new google-service.json file.

    – Meera Potdar
    Jan 4 at 4:32











  • Yes, please see the documentation for how to set it up.

    – Dennis Alund
    Jan 7 at 7:52














  • 1





    Thank you for your guidance. I would like to implement your solution and let you know If any help required.

    – Meera Potdar
    Jan 2 at 7:27











  • Can you please explain to me How to make multiple google-services.json files of the same project? I made two flavors internal and production, So I need to create two google-services.json files according to application Ids. Do I need to create two different projects on firebase?

    – Meera Potdar
    Jan 3 at 7:12













  • You get one google-services.json for each app that you add to Firebase. So the same way you added the first app to Firebase, you repeat for the flavor with the applicationIdSuffix. It's the same procedure whether you are having two separate Firebase projects or if you're adding both flavors to the same project.

    – Dennis Alund
    Jan 3 at 8:07











  • I create a new project on firebase to get a new google-service.json file.

    – Meera Potdar
    Jan 4 at 4:32











  • Yes, please see the documentation for how to set it up.

    – Dennis Alund
    Jan 7 at 7:52








1




1





Thank you for your guidance. I would like to implement your solution and let you know If any help required.

– Meera Potdar
Jan 2 at 7:27





Thank you for your guidance. I would like to implement your solution and let you know If any help required.

– Meera Potdar
Jan 2 at 7:27













Can you please explain to me How to make multiple google-services.json files of the same project? I made two flavors internal and production, So I need to create two google-services.json files according to application Ids. Do I need to create two different projects on firebase?

– Meera Potdar
Jan 3 at 7:12







Can you please explain to me How to make multiple google-services.json files of the same project? I made two flavors internal and production, So I need to create two google-services.json files according to application Ids. Do I need to create two different projects on firebase?

– Meera Potdar
Jan 3 at 7:12















You get one google-services.json for each app that you add to Firebase. So the same way you added the first app to Firebase, you repeat for the flavor with the applicationIdSuffix. It's the same procedure whether you are having two separate Firebase projects or if you're adding both flavors to the same project.

– Dennis Alund
Jan 3 at 8:07





You get one google-services.json for each app that you add to Firebase. So the same way you added the first app to Firebase, you repeat for the flavor with the applicationIdSuffix. It's the same procedure whether you are having two separate Firebase projects or if you're adding both flavors to the same project.

– Dennis Alund
Jan 3 at 8:07













I create a new project on firebase to get a new google-service.json file.

– Meera Potdar
Jan 4 at 4:32





I create a new project on firebase to get a new google-service.json file.

– Meera Potdar
Jan 4 at 4:32













Yes, please see the documentation for how to set it up.

– Dennis Alund
Jan 7 at 7:52





Yes, please see the documentation for how to set it up.

– Dennis Alund
Jan 7 at 7:52













0














Firebase will not differentiate between debug and production versions logs/crashes in crashlytics if you have set auto collection of logs. You can use a logging library to only send logs and crashes if the app build.gradle has debug:fasle i.e. production.
You can look at the Timber logging library which has a great example of adding crash reporting. https://github.com/JakeWharton/timber



You have to disable the auto initialization of crashlytics in manifest to have control when crashes are sent to firebase



<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="false" />


Then in your Application class's onCreate you check if BuildConfig.DEBUG is true you will not initialize crashlaytics so your debug logs and exceptions will not go to firebase, resulting in only production crashes.



For timber when you want to put logs and crashes to firebase you can use this Tree:



/**
* {@link Timber.Tree} using {@link Crashlytics} as crash reporting
*/
private static class CrashReportingTree extends Timber.Tree {

CrashReportingTree(Context context) {
CrashlyticsCore core = new CrashlyticsCore.Builder()
.disabled(BuildConfig.DEBUG)
.build();
Fabric.with(context, new Crashlytics.Builder().core(core).build());
}

@Override
protected void log(int priority, String tag, @NonNull String message, Throwable t) {
// don't report log to Crashlytics if priority is Verbose or Debug
if (priority == Log.VERBOSE || priority == Log.DEBUG) {
return;
}
Crashlytics.log(priority, tag, message);

if (t != null) {
if (priority == Log.ERROR) {
Crashlytics.logException(t);
}
}

}
}


For debug mode you should not send crashes to firebase as you can check the debug logs locally.






share|improve this answer
























  • Thank you so much for your brief description. I would like to check first, It is working properly for me or not. Let you know If I need any help.

    – Meera Potdar
    Jan 2 at 7:22
















0














Firebase will not differentiate between debug and production versions logs/crashes in crashlytics if you have set auto collection of logs. You can use a logging library to only send logs and crashes if the app build.gradle has debug:fasle i.e. production.
You can look at the Timber logging library which has a great example of adding crash reporting. https://github.com/JakeWharton/timber



You have to disable the auto initialization of crashlytics in manifest to have control when crashes are sent to firebase



<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="false" />


Then in your Application class's onCreate you check if BuildConfig.DEBUG is true you will not initialize crashlaytics so your debug logs and exceptions will not go to firebase, resulting in only production crashes.



For timber when you want to put logs and crashes to firebase you can use this Tree:



/**
* {@link Timber.Tree} using {@link Crashlytics} as crash reporting
*/
private static class CrashReportingTree extends Timber.Tree {

CrashReportingTree(Context context) {
CrashlyticsCore core = new CrashlyticsCore.Builder()
.disabled(BuildConfig.DEBUG)
.build();
Fabric.with(context, new Crashlytics.Builder().core(core).build());
}

@Override
protected void log(int priority, String tag, @NonNull String message, Throwable t) {
// don't report log to Crashlytics if priority is Verbose or Debug
if (priority == Log.VERBOSE || priority == Log.DEBUG) {
return;
}
Crashlytics.log(priority, tag, message);

if (t != null) {
if (priority == Log.ERROR) {
Crashlytics.logException(t);
}
}

}
}


For debug mode you should not send crashes to firebase as you can check the debug logs locally.






share|improve this answer
























  • Thank you so much for your brief description. I would like to check first, It is working properly for me or not. Let you know If I need any help.

    – Meera Potdar
    Jan 2 at 7:22














0












0








0







Firebase will not differentiate between debug and production versions logs/crashes in crashlytics if you have set auto collection of logs. You can use a logging library to only send logs and crashes if the app build.gradle has debug:fasle i.e. production.
You can look at the Timber logging library which has a great example of adding crash reporting. https://github.com/JakeWharton/timber



You have to disable the auto initialization of crashlytics in manifest to have control when crashes are sent to firebase



<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="false" />


Then in your Application class's onCreate you check if BuildConfig.DEBUG is true you will not initialize crashlaytics so your debug logs and exceptions will not go to firebase, resulting in only production crashes.



For timber when you want to put logs and crashes to firebase you can use this Tree:



/**
* {@link Timber.Tree} using {@link Crashlytics} as crash reporting
*/
private static class CrashReportingTree extends Timber.Tree {

CrashReportingTree(Context context) {
CrashlyticsCore core = new CrashlyticsCore.Builder()
.disabled(BuildConfig.DEBUG)
.build();
Fabric.with(context, new Crashlytics.Builder().core(core).build());
}

@Override
protected void log(int priority, String tag, @NonNull String message, Throwable t) {
// don't report log to Crashlytics if priority is Verbose or Debug
if (priority == Log.VERBOSE || priority == Log.DEBUG) {
return;
}
Crashlytics.log(priority, tag, message);

if (t != null) {
if (priority == Log.ERROR) {
Crashlytics.logException(t);
}
}

}
}


For debug mode you should not send crashes to firebase as you can check the debug logs locally.






share|improve this answer













Firebase will not differentiate between debug and production versions logs/crashes in crashlytics if you have set auto collection of logs. You can use a logging library to only send logs and crashes if the app build.gradle has debug:fasle i.e. production.
You can look at the Timber logging library which has a great example of adding crash reporting. https://github.com/JakeWharton/timber



You have to disable the auto initialization of crashlytics in manifest to have control when crashes are sent to firebase



<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="false" />


Then in your Application class's onCreate you check if BuildConfig.DEBUG is true you will not initialize crashlaytics so your debug logs and exceptions will not go to firebase, resulting in only production crashes.



For timber when you want to put logs and crashes to firebase you can use this Tree:



/**
* {@link Timber.Tree} using {@link Crashlytics} as crash reporting
*/
private static class CrashReportingTree extends Timber.Tree {

CrashReportingTree(Context context) {
CrashlyticsCore core = new CrashlyticsCore.Builder()
.disabled(BuildConfig.DEBUG)
.build();
Fabric.with(context, new Crashlytics.Builder().core(core).build());
}

@Override
protected void log(int priority, String tag, @NonNull String message, Throwable t) {
// don't report log to Crashlytics if priority is Verbose or Debug
if (priority == Log.VERBOSE || priority == Log.DEBUG) {
return;
}
Crashlytics.log(priority, tag, message);

if (t != null) {
if (priority == Log.ERROR) {
Crashlytics.logException(t);
}
}

}
}


For debug mode you should not send crashes to firebase as you can check the debug logs locally.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 2 at 7:09









Umar HussainUmar Hussain

2,1201819




2,1201819













  • Thank you so much for your brief description. I would like to check first, It is working properly for me or not. Let you know If I need any help.

    – Meera Potdar
    Jan 2 at 7:22



















  • Thank you so much for your brief description. I would like to check first, It is working properly for me or not. Let you know If I need any help.

    – Meera Potdar
    Jan 2 at 7:22

















Thank you so much for your brief description. I would like to check first, It is working properly for me or not. Let you know If I need any help.

– Meera Potdar
Jan 2 at 7:22





Thank you so much for your brief description. I would like to check first, It is working properly for me or not. Let you know If I need any help.

– Meera Potdar
Jan 2 at 7:22


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54001966%2ffirebase-crashlytics-doesnt-show-crashes%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

'app-layout' is not a known element: how to share Component with different Modules

android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

WPF add header to Image with URL pettitions [duplicate]