Releasing 2 applications based on same code but different package name
Like many Android developers I want to have two programs for MarketPlace - a demo and a full version - they both have the same code but use different assets. Unfortunately as they have the same package namespace they cannot both be loaded onto the same device. By the way, the assets are in an asset folder and not in the res folder.
I want to make the second apk via the command line and derive it from the first apk that was compiled/built using NetBeans/Eclipse IDE.
The answer seemed to be aapt and its --rename-package-manifest
option but I clearly don't understand how to use it.
I do the following steps:
Build my full apk using NetBeans
Unpack apk with apktool
Add the new assets
Rename the package with aapt
Repack into demo version using apktool.
However, I cannot get step 4 - the aapt rename stage to work. I have seen so many threads on the web about this but no explicit example.
I then tried the very simplest of 开发者_开发百科programs to test it out - an Hello World using following the steps here.
The Hello World works fine using command line options, it builds and runs on both emulator and device.
However, when I use the aapt --rename-manifest-package
command it gives lots of errors.
The command I use is:
aapt package -f -v -M c:\android-sdk-windows\tools\hellow\AndroidManifest.xml -S c:\android-sdk-windows\tools\hellow\res —rename-package-manifest com.myname.demo
The errors are in both the main.xml
and the AndroidManifest.xml
are of the form:
"No resource identifier found for attribute 'layout_width'"
Any ideas would be really welcome.
Use an Android library project, as this was designed with your scenario in mind. Here are instructions for using Android library projects with Eclipse or without Eclipse.
精彩评论