Manish Kumar
Manish Kumar

Reputation: 10482

For a IONIC project change .apk name

While building ionic app, by default ionic is creating platforms/android/build/outputs/apk/android-debug.apk file. How can i change the name of generated .apk file?

Upvotes: 1

Views: 6012

Answers (1)

Naresh Kumar
Naresh Kumar

Reputation: 938

You will need to update the following files:

YourProjectName/platforms/android/AndroidManifest.xml YourProjectName/platforms/android/build.xml YourProjectName/platforms/android/src/com/yourpackagename/appfolder/CordovaApp.java

NOTE: From the above (file 3), com/yourpackagename/appfolder will correspond to the reverse domain name you used when when set up your application.

STEP 1 Got to the AndroidManifest.xml file and look for:

<activity android:configchanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchmode="singleTop" android:name="CordovaApp" android:screenorientation="portrait" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowsoftinputmode="adjustResize">

Change CordovaApp in android:name="CordovaApp" to whatever the name of your project is (android:name="testApp").

STEP 2: In the build.xml file locate the following line:

Change CordovaApp to the name of your project and should match the one in put in step 1 (i.e name="testApp").

STEP 3 This stage is abit more tricky and extra caution should be taken when doing this, or else you might mess things up big time...and that is not Awesome!!

Locate the file Cordova.java and rename it to project name (Same as step 1 and 2...i.e testApp.java).

Open the renamed file and locate the line : public class CordovaApp extends CordovaActivity change it to the project name like: public class testApp extends CordovaActivity

.....That's it!!!

Run the command : ionic build android --release

This should result in:

Built the following apk(s):
    /Path-to-your-project/platforms/android/ant-build/testApp-release-unsigned.apk

Upvotes: 1

Related Questions