开发者

Releasing 2 applications based on same code but different package name

开发者 https://www.devze.com 2023-02-05 14:21 出处:网络
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 packag

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:

  1. Build my full apk using NetBeans

  2. Unpack apk with apktool

  3. Add the new assets

  4. Rename the package with aapt

  5. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消