0

We are working on a mobile first hybrid application , we have multiple environments DEV, QA , STAGING and PROD. While this application is being tested on Android/iPhone devices, our testers some times needs to install apks/ipa files for multiple environments (DEV/QA for example) at the same time . Now What we are doing is we uninstall the DEV version before installing the QA version.

What is the best option to install both DEV/QA applications on the same device at a time.

One option is to rename the application for different environments as say app-DEV , app-QA as a part of the build process. Is this the best option . If yes what are the files we need to make this name change. Any better option

santhosh
  • 69
  • 1
  • 12
  • 1
    If you are signing your applications with same "package name" for Android and same bundleID for iOS. you can't install them on the same device if you are switching from env to env, they will overwrite each other. Changing the app name won't resolve the issue for you. You need to change the package name for android and BundleID for iOS. – Sami Aug 07 '15 at 16:16

2 Answers2

1

To have multiple versions of one app installed on one device they all need to have different package name. Check this question to learn how to change it

Community
  • 1
  • 1
Victoria
  • 198
  • 1
  • 12
0

We use the ant builds to rename the package depending on environment: ex. using ant and xmltask. env is environment(dev, test,qa) we are updating the manifest package, and the application title.. ucFirst is a javascript task that uCases the first letter of the String

Android

<target name="updateAndroidPackage" depends="checkProd" unless="isProd">
  <echo>In Update Android Package:${env}:</echo>
  <xmltask source="${appPath}/${appName}/android/native/AndroidManifest.xml" dest="${appPath}/${appName}/android/native/AndroidManifest.xml">
    <copy path="/manifest/@package" property="origPackageName"/>
  </xmltask>
  <echo>Existing Package:${origPackageName}</echo>
  <xmltask source="${appPath}/${appName}/android/native/AndroidManifest.xml" dest="${appPath}/${appName}/android/native/AndroidManifest.xml">
    <replace path="/manifest/@package" withText="${origPackageName}${env}"/>
  </xmltask>

  <ucfirst string="${env}" to="envFirst" />
  <xmltask source="${appPath}/${appName}/android/native/res/values/strings.xml" dest="${appPath}/${appName}/android/native/res/values/strings.xml">
    <replace path="/resources/string[@name='app_name']/text()" withText="${appName} ${envFirst}"/>
  </xmltask>
</target>

IOS:

<target name="renamePackage" depends="checkProd" unless="isProd">
        <ucfirst string="${env}" to="envFirst" />
        <exec executable="/usr/libexec/PlistBuddy">
            <arg value="-c" />
            <arg value="Set :CFBundleIdentifier com.client.${env}.${appName}" />
            <arg value="${appPath}/${appName}/${iosPath}/${appName}${appName}Iphone-Info.plist" />
        </exec>
        <exec executable="/usr/libexec/PlistBuddy">
            <arg value="-c" />
            <arg value="Set :CFBundleDisplayName ${appName} ${envFirst}" />
            <arg value="${appPath}/${appName}/${iosPath}/${appName}${appName}Iphone-Info.plist" />
        </exec>

    </target>
tik27
  • 2,698
  • 1
  • 16
  • 25