Disable Crashlytics Build Id automatic generation - android

I need to disable Crashlytics build_id automatic generation every time I assemble a new build because of CI requirements.
According to fabric docs, it's as simple as adding the next flag inside my build type:
android {
buildTypes {
debug {
ext.alwaysUpdateBuildId = false
...
}
release {
ext.alwaysUpdateBuildId = false
...
}
But for some reasons it's only working for debug builds and not on the release ones.
What am I doing wrong?

It's working fine in the latest version of Fabric Gradle plugin

Related

How to prevent Crashlytics from logging crashes during development in Android

While developing the app sometimes it crashes, and It's known crash while development, It unnecessarily sends mail to the client that some Trending stability issues in the app.
So I want to know if any method is there to stop logging while the development journey.
Crashlytics gives you the option to opt in or out from sending crash reports. You could use this in your code to prevent sending crash reports during development.
For this you could set the firebase_crashlytics_collection_enabled property in the AndroidManifest.xml file to false.
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="false" />
With this option you will can then re-enable Crashlytics data collection when running the release version:
if(!BuildConfig.DEBUG){
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true);
}
Or a similar option could be disabling Crashlytics data collection only when running the debug build. In this case, the the manifest property is not required.
if(BuildConfig.DEBUG){
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(false);
}
you can disable uploading of mapping file and symbols in debug build:
buildTypes {
release {
firebaseCrashlytics {
mappingFileUploadEnabled true
nativeSymbolUploadEnabled true
}
}
debug {
firebaseCrashlytics {
// If you don't need crash reporting for your debug build,
// you can speed up your build by disabling mapping file uploading.
mappingFileUploadEnabled false
nativeSymbolUploadEnabled false
}
}
}
}

log message in gradle build doesn't show in gradle console of Android Studio

My build.gradle would like to log messages, I tried:
signingConfigs {
debug {
...
}
release {
...
project.logger.info("I am releasing build!");
}
}
buildTypes {
debug {
...
}
release {
signingConfig signingConfigs.release
project.logger.info("I am releasing build too!");
}
}
I choose "release" from build variant. But when I run build, I can't find the log message from "Gradle Console" on the right-bottom of Android Studio. Why? (I am using Android Studio 3.0.1)
You are logging with info level. To show info messages you have to run your tasks with --info or lower flag.
To print your message without any additional flag you should use lifecycle logging level eg project.logger.lifecycle('I am releasing build too!') or just print to System.out println('I am releasing build too!')
You may read more about logging at gradle tasks here https://docs.gradle.org/current/userguide/logging.html

Disable mapping file (deob) upload on proguard build for Android Fabric/Crashlytics

Android App using proguard:
Crashlytics automatically uploads the mapping files for reach of your build variants.
https://docs.fabric.io/android/crashlytics/dex-and-proguard.html#gradle
We need to get rid off this warning since our bamboo build agent has no outside connection.
WARN - Crashlytics had a problem uploading the deobs file.
Please check network connectivity and try again.
build 22-Jan-2018 15:20:18
com.crashlytics.reloc.org.apache.http.conn.HttpHostConnectException: Connect to cm.crashlytics.com:443
How can we disable this upload feature?
Edit - clarification: We do not want to disable crashlytics for this build; in fact we need it.. We just want to disable the upload of the mapping file since we have no outside connection on this agent.
Thanks in advance.
You can disable tasks by setting the enabled-flag in your top-level build.gradle file for specific tasks to false.
subprojects {
tasks.whenTaskAdded { task ->
boolean isCrashlyticsTask = task.name.toLowerCase().contains("crashlytics")
if (isCrashlyticsTask) {
task.enabled = false
}
}
}
How about:
android {
buildTypes {
debug {
ext.enableCrashlytics = false
...
As in the crashlytics documentation.

Fabric Distribution with Gradle not Sending Invitation

I am trying to distribute Android beta builds via fabric following https://docs.fabric.io/android/beta/gradle.html.
After running gradle assembleRelease crashlyticsUploadDistributionRelease
, the build was successfully uploaded to fabric, but the problem is that nobody was invited for testing. Any settings I am missing here?
And this is my setting in the gradle file:
ext.enableCrashlytics = true
ext.betaDistributionReleaseNotes="Hello World"
ext.betaDistributionEmails="yzhong#gmail.com"
The settings has to be under android > buildTypes > release, as the following:
android {
buildTypes {
release {
signingConfig signingConfigs.release
ext.betaDistributionReleaseNotes="Hello World"
ext.betaDistributionEmails="yzhong#gmail.com"
🤔🤣

Cannot see parameter value in Android Studio when breakpoint is in first line of a method

I am just switching from Eclipse to Android Studio and found this weird behavior. When I add a breakpoint in the first line of a method, I cannot see the parameter values. The only thing I can see then is the this reference. I either have to make one debug step or set the breakpoint to a line after the first one to see the parameter values.
Anyone else has this problem or knows what's going wrong here?
Try turning off your jacoco test coverage off for the debug build in your build.gradle file:
debug {
...
testCoverageEnabled false
}
This completely fixed the issue for me where upgrading the gradle plugin did not.
A good solution until AOSP Issue #123771 is solved, is to use the snippet provided by Stuart in the comments section:
buildTypes {
debug {
[...]
testCoverageEnabled true
}
release {
[...]
}
debuggable.initWith(buildTypes.debug)
debuggable {
testCoverageEnabled false
}
}
This way you can both keep your test coverage reports in your debug build and have a way of stepping through code seeing your local variables.
I don't have in my gradle file:
debug {
...
testCoverageEnabled true
}
but had the same issue on Android Studio 2.2. Solution that helped me to resolve issue:
Disable Instant Run in IDEA Settings.
Re-build project.
Enable Instant Run.
The solution provided by Google here is to upgrade the Android Studio Gradle plugin to v1.0.1
If your build uses the jack toolchain this can be the source of the problem. In my case, disabling jack solves the problem:
buildTypes {
...
debug {
jackOptions {
enabled false
}
}
}
Note: 1.8 source compatibility requires jack!
I got sick of toggling testCoverageEnabled when I wanted to debug so set up a project property to disable it when run from Android Studio, but default to enabled when run from command line with no options such as on a build box.
// Default to true, set -PtestCoverageEnabled=false in IDE compiler command-line options
def isTestCoverageEnabled = { ->
def enabled = project.hasProperty('testCoverageEnabled') ? testCoverageEnabled.toBoolean() : true
println "testCoverageEnabled = " + (enabled ? "true" : "false")
return enabled
}
android {
buildTypes {
debug {
testCoverageEnabled isTestCoverageEnabled()
}
}
}
To set the property in the IDE add the command-line option -PtestCoverageEnabled=false
Android Studio -> Preferences -> Build, Execution, Deployment -> Compiler -> Command-line Options
I ran into this issue when trying to debug an app that was previously installed using an APK and not from Android Studio itself. Fixed it by uninstalling the app and re-run the debug.
Following configuration worked for me for buildType release.
buildTypes {
release{
testCoverageEnabled = false
debuggable true
minifyEnabled false
shrinkResources false
}

Categories

Resources