vomop.blogg.se

Android studio install two versions of same app
Android studio install two versions of same app





  1. Android studio install two versions of same app how to#
  2. Android studio install two versions of same app apk#
  3. Android studio install two versions of same app android#
  4. Android studio install two versions of same app pro#

In contrast, a flavor can specify features, device and API requirements (such as custom code, layout and drawables), and minimum and target API levels among others. The default build types are debug and release. A build type applies settings relating to the build and packaging of the app, such as if it’s debuggable and the signing keys.

Android studio install two versions of same app android#

Please enable JavaScript to view the comments powered by Disqus.In addition to flavors, there is another very important concept regarding building android apps, called “build types”. I hope this trick helps to expedite the coding process.

android studio install two versions of same app

Just changing the package name of the APKs at the compile time via gradle actually does the needful. As the, Google’s PlayStore treats different package names as different apps, so does our phone. Gradle build system helps us in doing this.

Android studio install two versions of same app apk#

It is too tough a job, sometimes, for an Android developer to install the APK of same version of the same app in a phone pointing to two or more environments(staging, production, debug etc.) but it can be easily achieved by just changing the package name of the builds. Gradle creates every combination between these groups for us. If you want to switch between different servers then the code below will might help you:īuildConfigField 'String', 'API_BASE_URL', """"īuildConfigField 'boolean', 'ISPRODUCTION', "false"īuildConfigField 'boolean', 'ISPRODUCTION', "true"įlavor Dimensions allow us to define groups of flavors.

Android studio install two versions of same app pro#

Just make sure you remove the "app_name" from strings.xml file from where your application name comes because we are defining the resource value of "string" with the name "app_name" as "My Free App" and "My Pro App".īasically, you can define almost any resource value in your gradle file and it will configure your app based on the build variants. The "free" version will be named as "My Free App" and "pro" app will be named as "My Pro App".

android studio install two versions of same app

This way, the application ID for the "free" product flavor is "" and for "pro" it will be "" because the applicationId will be suffixed by "free" and "pro" (by using applicationIdSuffix) respectively and so as the application ID differs due to this suffix, there will be two instances of the same app in your device pointing to different environments!Īlso, one thing to note, the two apps will have different app names as well. ResValue "string", "app_name", "My Pro App" ResValue "string", "app_name", "My Free App"

android studio install two versions of same app

For each flavor inside the productFlavors block, you can redefine the application ID property, or you can instead append a segment to the default application ID using applicationIdSuffix, as shown here: In this case, each build variant should be defined as a separate product flavor. However, if you want to make multiple versions of your app to appear as different listings on the Google Play Store, such as a "free" and "pro" version, then you need to create separate build variants so that each have a different application ID. The answer is simple, through different build variants.įor the APK,the application ID is tagged with the APK by the build tools defined in the defaultConfig block from the adle file (as shown below).

android studio install two versions of same app

Android studio install two versions of same app how to#

Now the question arises, as to how to define the multiple application ID of the same application? So, basically if we define multiple application ID according to different instances, it will result in having multiple APKs of the same app in the same device without changing or switching the user, which is not what we need. Your application ID is defined with the application ID property in your module's adle file, as shown here: While developing one of the apps for a client, I felt the need of one necessary requirement which was to install two or more instances of the same app in your Android phone without creating a new user or pointing to different servers.īut, before we move on to understanding how to install multiple variants of the same app in your phone, let's see what is an Application ID in an Android build system.







Android studio install two versions of same app