change MainActivity to whatever name you want. ex:ItsMyCodeShare
STEP 2:
In the build.xml file locate the following line:
<project name="MainActivity" default="help">
Change MainActivity to the name of your project and should match the one in put in step 1 (i.e
name="ItsMyCodeShare").
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 MainActivity.java and rename it to project name (Same as
step 1 and 2...i.e ItsMyCodeShare.java).
- Open the renamed file and locate the line :
public class MainActivity extends CordovaActivity change it to the project name like:
public class ItsMyCodeShare extends CordovaActivity
Sorry to disappoint you but.....That's it!!!
Run the command : ionic build android --release
more so, we are ready with our desired name.apk file.
Lets start signing it now.
1) Generate Private key
2) Sign the apk
3) zip the apk
For the above steps you will be using keytool, jarsigner and zipalign tools respectively.
1)keytool will be available in "C:\Program Files\Java\jre7\bin"
2)jarsigner will be available in "C:\Program Files\Java\jdk1.7.0_79\bin"
3)zipalign will be available in "C:\Users\e571224\AppData\Local\Android\sdk\build-tools\22.0.1"
Note:build-tools version(22.0.1) might vary depending on your installed version.
Step 1:
we need to generate a private key using keytool of JDK.
open your command prompt and enter keytool. if it is not recognized add your jre/bin to Path environment variable.
Then, use the following command to generate the private key
keytool -genkey -v -keystore yourapp-release-key.keystore -alias app_alias_name -keyalg RSA -keysize 2048 -validity 10000
yourapp-release-key.keystore is now generated in that folder. copy and keep it safe.
It will ask for a password, followed by some security questions. remember the password.(take a screenshot to be on safer side)
Step 2:
we need to sign our unsigned apk with the above private key.
copy the private key (yourapp-release-key.keystore, generated in above step) into the folder in which your apk is present. Also, make sure to add the jdk/bin to Path environment variable.
now, run the below command to sign it.
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore yourapp-release-key.keystore yourapp-release-unsigned.apk app_alias_name
enter the password and your apk is signed now.
Step 3:
we use the zipalign tool to generate the apk. zipalign is available in build-tools/yourversion. add that path to your environment variables.
Now, run the below command to generate the apk:
zipalign -v 4 yourapp-release-unsigned.apk ItsMyCodeShare.apk
this will generate the apk file which you can ship to play store.
References:
http://ionicframework.com/docs/guide/publishing.html
http://forum.ionicframework.com/t/renaming-android-build-apk-from-cordovaapp-to-your-app-name/15416