Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crashlytics - different package names for different gradle flavours

I am trying to setup an Android app, using Android Studio with 2 different flavours. Each flavour changes packageName and applicationId - since I want 2 separate APK's submitted as 2 different products to Google Play.

I also try to setup separate apps in Crashlytics, one for each flavour. Although the first one was created without any problem, when I switch flavour, Crashlytics plugin for Android Studio still thinks that my project is already setup. So currently I cannot setup my Crashlytics for second flavour properly.

Thanks in advance for any suggestions.

like image 776
lookashc Avatar asked Sep 05 '14 14:09

lookashc


2 Answers

As suggested by m4ch3t3 this workaround worked perfectly:

I created an empty project with package name matching the other flavour. Using this project I created new app in Crashlytics. Then I compiled both flavours of my real project and caused fake crashes in them. Crashes were reported into matching Crashlytics apps

You can define different package name by definining applicationId in your app build.gradle as follow:

productFlavors {

        dev {
            applicationId "dev.myapp.app"
        }

        prod {
            applicationId "prod.myapp.app"
        }
    }
like image 130
firegloves Avatar answered Oct 26 '22 23:10

firegloves


Using the Crashlytics plugin for Android Studio will be a PITA in your case.

What you really need is only the API key and secret - shared among the same organisation - so if you already have one app correctly deployed on Crashlytics you can access those data from your organisation profile.

Just log out from the android studio plugin (CTRL+L while the plugin popup is focused), and take a look at this answer that explain how to deal with multiple flavour and multiple keys.

like image 33
a.bertucci Avatar answered Oct 26 '22 22:10

a.bertucci