Is there a way to excecute the Eclipse command "Android Tools -> Rename Application Package" as a script from the shell?
I want to compile my Android application several times with different options (e.g. free and paid version) without doing some things manually. It is important to do this automatically. All solutions like libraries won't help because several things have to be done by hand.
Yes, it is possible. You have to manually call aapt tool to package the compiled project, then call aapt again to add the classes, sign it with jarsigner and align it with zipalign. Normally, the Eclipse ADT plugin does the chain of build steps for you.
Example calls of the steps would be following.
-
Packaging the app with different package name:
aapt package -f -M ./AndroidManifest.xml -S res/ \ -I android.jar -F renamed_project.apk.unaligned \ --rename-manifest-package "com.example.some_new_package" -v -
Then add the classes:
aapt add -f renamed_project.apk.unaligned classes.dex -v -
Sign it:
jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 \ -keystore "some_keystore_file" \ renamed_project.apk.unaligned "key_name" -
Align it:
zipalign -v 4 renamed_project.apk.unaligned renamed_project.apk
Some more information can be found for example here.
Also you can do it more easily with Ant. Here you can find some more information.
Renaming an Application- The Complete Guide
A) for changing Just the application name (App name which is displayed below icon) in the Manifest.xml file, in <application tag, android:label="YourAppName" then do the same in All the <activity Tags B) For changing EVERYTHING (folder names, Package names, Refrences,app name, etc.) *1) Renaming package names in gen folder and manifest.xml Right Click on Your project Android tools- Rename Application Package *2) Renaming package names in src folder Expand src folder, Click on package (Single click) Press Alt+Shift+R Check Update references and Rename subpackages 3) Renaming the app's main Folder (Optional) click on the application's folder (Single click) then Press Alt+Shift+R 4) Renaming application name- Refer "A)"
No comments:
Post a Comment