How to Change Package ID of an Android App
How to Change Package ID of an Android App ka20h00000013pMAAQ | GE Customer Center
How to Change Package ID of an Android App
- Id:
- 000033783
- Average User Rating: (*)(*) (*) ( ) ( )
- Your Rating: (*)(*) (*) (*) (*)
- Last Updated: 09/22/2020
- Date Created: 05/22/2019
- Products: APM Classic Health
- Categories: How To
Objective
If you are using a Mobile Device Management (MDM) solution linked to a Managed Google Play account, then you will need to change the Package ID of GEDigitalAPM.apk to something unique before uploading it to your own managed Google Play Store. This Article provides the steps to change the Package ID.
Environment
Primary Product Module : Rounds Data Collection
Primary Product Version : v4.3.x
Primary Product OS : Other
Procedure
Prerequisites:
- Any toolkit that allows modification of APK files, one example: Apktool from Apktool - How to Install (NOTE: External website, not affiliated with GE-Digital)
- Install Android SDK (instructions: How to install the Android SDK on Windows, Mac and Linux | Android Central ). (NOTE: External website, not affiliated with GE-Digital)
- Using SDK manager, install SDK platform and Build tools for API level 26 for releases prior to 4.4 and API level 28 for releases 4.4 and above.
Steps:
- Open Command Prompt as Administrator, and navigate to directory that has the apk file.
- Run following command to decode the apk file:
- apktool d GEDigitalAPM.apk
- Wait for Step 2 to finish executing. Once finished, this will create a GEDigitalAPM folder in the same directory.
- Open the whole GEDigitalAPM folder in a text editor (for ex: Sublime Text or VS Code).
- Open AndroidManifest.xml file, and change the "package" attribute to an Id in the following format: com.<your-organization-name>.apm. Save the file.
- Open apktool.yml file, and change "renameManifestPackage" attribute to the Id that was chosen in Step 5. Save the file.
- Search for text "com.ge.ent.apm" ( com.meridium.apmv4 in versions prior to 4.3.1) in the entire folder. Except for files inspection-view.js, rounds-user-overview.js and zebra-barcode-scanner.js, replace all other instances with the the Id chose in Step 5. Save the files that changed.
- Now search and replace "com/ge/ent/apm" (com/meridium/apmv4 in versions prior to 4.3.1) with "com/<your-organization-name>/apm". Save the files that changed.
- Navigate to smali → com folder. Create a new folder named "<your-organization-name>". Navigate to the new folder and inside that folder, create a new folder "apm".
- Move all files from folder "com → ge → ent → apm" (com → meridium → apmv4 in versions prior to 4.3.1) to "com → <your-organization-name> → apm".
- In the command prompt opened in Step 1, run following command:
- apktool b GEDigitalAPM -o GEDigitalAPM-Unsigned.apk
- Wait for Step 11 to finish executing. Once finished, this will generate GEDigitalAPM-Unsigned.apk file.
- Next, we will start the signing process.
- We will generate a key store required to sign the app. Find keytool.exe located in the Java JDK installation path.
- In the same command prompt window, run the following command to generate key store: "<Java JDK path>\keytool.exe" -genkey -v -keystore mynewapp-key.keystore -alias mynewapp-key -keyalg RSA -keysize 2048 -validity 10000
- You will be asked to answer the prompts. After that, it generates a Keystore file named "mynewapp-key.keystore".
- We will now use the keystore to sign the apk file. Find jarsigner.exe located in the Java JDK installation directory.
- In the same command prompt window, run the following command to sign the apk file:
- "<Java JDK path>\jarsigner.exe" -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore mynewapp-key.keystore GEDigitalAPM-Unsigned.apk mynewapp-key
- Next, we will align the apk file to complete the signing of apk file. To do that, we need “Zipalign” tool, found in the Android SDK’s build tools location. Please use 26.x API level of Android SDK build tool to perform alignment for product versions 4.3.1 and earlier, and 28.x API level of Android SDK build tool to perform alignment for product versions 4.4 and later
In the same command prompt window, run following command to align the apk file:
"<Android_SDK_location">\build-tools\<26.x (release prior to 4.4) or 28.x (release 4.4 and above)>\zipalign.exe" -v 4 GEDigitalAPM-Unsigned.apk GEDigitalAPM-Signed.apk
Now GEDigitalAPM-Signed.apk is signed with new package id (that was specified in step 5).
20. You may now upload GEDigitalAPM-Signed.apk to your managed Google Play store.
Please Note: The users should not update the version number in any of the files during the app ID change process. But instead appID has to be different than your existing app ID in InTunes, this is to compensate the issues that we have in 4.3.0.7.x versions, this is fixed in 4.3.1 and above.