How to disable Crashlytics during development
Marc from Crashlytics here. Here's a couple of ways to disable Crashlytics while you are doing your debug builds!
Use a different android:versionString for debug and release builds and then disable crash reporting from the Crashlytics web dashboard for the debug version.
Wrap the call to Crashlytics.start() in an if statement that checks a debug flag. You could use either a custom flag or an approach like the ones proposed here: How to check if APK is signed or "debug build"?
New Firebase Crashlytics disable in debug mode
I have tried once some time ago which worked for me . Add this to build.gradle
.
android {
buildTypes {
debug {
manifestPlaceholders = [crashlyticsCollectionEnabled:"false"]
...
}
release {
manifestPlaceholders = [crashlyticsCollectionEnabled:"true"]
...
}
}
}
And then set this attribute in manifest .
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="${crashlyticsCollectionEnabled}" />
If you log manually also then you can use something like this at runtime :-
FirebaseCrashlytics.getInstance().recordException(RuntimeException("Invalidtoken"))
Also Check this out .
How to disable Crashlytics for iOS during development?
Development builds are also DEBUG
builds, You are probably meaning Ad-Hoc builds.
Since the release and Ad-Hoc build use the same configuration you will not be able to tell them apart.
You bets option is to create a new configuration for the AppStore. For this configuration add a Preprocessor Macro
, Like FABRIC=1
Then in you build code:
#ifdef FABRIC
[Fabric with:@[CrashlyticsKit]];
#endif
Disable firebase crashlytics for Android
Disable Crashlytics at runtime
// Set up Crashlytics, disabled for debug builds
Crashlytics crashlyticsKit = new Crashlytics.Builder()
.core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build())
.build();
Fabric.with(this, crashlyticsKit);
Ex
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Set up Crashlytics, disabled for debug builds
Crashlytics crashlyticsKit = new Crashlytics.Builder()
.core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build())
.build();
Fabric.with(this, crashlyticsKit);
setContentView(R.layout.activity_main);
}
More
boolean Agrees = value;
if(Agrees)
{
Fabric.with(this,new Crashlytics());
}
else
{
CrashlyticsCore core = new CrashlyticsCore.Builder().disabled(true).build();
Fabric.with(this, new Crashlytics.Builder().core(core).build());
throw new RuntimeException("why doesn't this show up in Firebase Crashlytics?");
}
Edit 2
Ref : Fabric's Crashlytics with Firebase can't be disabled for DEBUG builds
The Firebase Crashlytics documentation explains that once reporting is enabled in an app session, it cannot be disabled.
By default, Crashlytics reporting is enabled in a ContentProvider
named CrashlyticsInitProvider that executes before your Application
instance is created. CrashlyticsInitProvider enables or disables reporting based on the meta-data value firebase_crashlytics_collection_enabled
, which by default is true.
If you want reporting disabled, it's critical that the manifest meta-data be present and set to false:
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="false" />
Look in the logcat during app initialization for the message:
CrashlyticsInitProvider: CrashlyticsInitProvider initialization successful
If the message is present, firebase_crashlytics_collection_enabled
is true. If the message is not present, you have successfully set the meta-data to disable crash reporting.
If the meta-data is missing or set to true, you cannot disable reporting in your code using a call to Fabric.with(...)
.
In a comment to another answer, you indicate that you tried disabling reporting using the meta-data and were not successful. Check for a typo and ensure the declaration is correctly placed in the <application>
element. In my tests, I am able to disabling reporting using the meta-data and then enable at run time.
How to disable Crashlytics while in debug mode, in react-native-firebase?
The documentation explains how to disable it
iOS
Turn off automatic collection with a new key to your Info.plist
file:
Key: firebase_crashlytics_collection_enabled
Value: false
<key>firebase_crashlytics_collection_enabled</key>
<false/>
Android
Turn off automatic collection with a meta-data tag in your AndroidManifest.xml
file:
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="false" />
Enable collection at runtime
You can can initialise crashlytics in your javascript code using
firebase.crashlytics().enableCrashlyticsCollection();
You can then use
if (__DEV__) {
} else {
}
to run any specific code in development or in production.
Related Topics
Android Studio: How to Generate Signed APK Using Gradle
Resize Image to Full Width and Variable Height with Picasso
Find the Key Hash for a Signed App
How to Remove the Title Text from the Android Actionbar
Background Service Getting Killed in Android
How to Show Popupwindow at Special Location
How to Programmatically Log Out from Facebook Sdk 3.0 Without Using Facebook Login/Logout Button
Android Screen Sizes in Pixels for Ldpi, Mdpi, Hpdi
Load Image from Url in Notification Android
Stop Scrollview from Setting Focus on Edittext
Android Disable Screen Timeout While App Is Running
Existing 3-Function Callback to Kotlin Coroutines
There Is No Debug.Keystore in .Android Folder
Handlers and Memory Leaks in Android
On Showing Dialog I Get "Can Not Perform This Action After Onsaveinstancestate"
How to Get Meid and Imei Information Using Adb Commands on Android 5.0