Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Having multiple builds of same flutter app on android device

For debugging purposes – I want to have multiple builds of my flutter app. One – should be from google play and few others like "App Name – Dev" Or "App Name – STG". I tried to use flavors and modifying android:label="@string/app_name" however I cant install new build of app – android complains with following message – app not installed as package conflicts with an existing package

So how do I have multiple builds of same app on my device?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

In device or playstore , app is identified by bundle id and as per error it looks like you are trying to install app with same bundle id which is already installed on device . To make same app different, you need to make bundle id different which you can achieve by flavours . Kindly consider below mentioned code

android {
    defaultConfig {
        applicationId "com.example.myapp"
    }
    productFlavors {
        free {
            applicationIdSuffix ".free"
        }
        pro {
            applicationIdSuffix ".pro"
        }
    }
}

here we have two flavours

  1. free
  2. pro

now both will have different bundle id as applicationIdSuffix will append string at the end of original bundle id

So for free flavour , it will be com.example.myapp.free and for pro flavour , it will be com.example.myapp.pro

For more details , you can check this link

https://developer.android.com/build/build-variants#groovy

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading