Search code examples
androidcrashlyticsgoogle-fabriccrashlytics-android

Change reported Version Number in Fabric Crashlytics


I use Crashlytics as my Crash tracking system in an android app. Due to hardware restrictions I am forced to use a non-standard variant for versioning.

The VersionCode remains the same (100), however the actual version is hidden within the versionName String which contains a Timestamp.

Is there something like:

Crashlytics.setVersion(myVersion)

I use

'io.fabric.tools:gradle:1.25.1'  
'com.google.firebase:firebase-plugins:1.1.1'
'com.crashlytics.sdk.android:crashlytics:2.6.8@aar'

Help appreciated


Solution

  • You can set custom keys in Crashlytics, which may solve your problem.

    For version codes this can be done with:

    Crashlytics.setInt("version_code", 155)
    

    Or for version names:

    Crashlytics.setString("version_name", "0.5.5")
    

    When a crash happens, this will then show up under the "Keys" tab:

    enter image description here

    More info on custom keys is available in the official documentation.

    As an aside, I'd also strongly recommend you post a question to help resolve the "can't change version code" issue you mentioned, that may cause you a lot of issues further down the line!