开发者

Is it possible to have a stable build and nightly build of app on my device?

I have a published app that I use daily, installed on my phone. I also want/need to continue developing it, and I debug on the same phone (no emulator). Using eclipse, is the best solution for me to rename the updated package while I build and debug it so that I can continue to use the old version, or is there another way? If that is the solution, can I refactor a package name or do I have to change all of those manually?

I did search, and don't bel开发者_开发百科ieve this is a duplicate as I do not want to publish multiple versions of the app. This would just be for me, and I am rooted if it would help my cause.


What has worked out great for me is using Android Library projects. I've got a Paid, Free and a dev version of my app which all use the same codebase.

My main codebase is an Android Library Project and I created other projects for the various versions. Then in your Application class, you differentiate between which version you're on to determine if you need different functionality. In your case, you'll just have a different package name.

Here's some links to get you started if you wanted to go that route. It's worked great for me, and I didn't want to go the route of Ant scripts:

http://developer.android.com/guide/developing/projects/projects-eclipse.html#SettingUpLibraryProject

http://blog.donnfelker.com/2010/08/05/howto-android-full-and-lite-versions/

http://www.marvinlabs.com/2011/01/sharing-code-full-lite-versions-application/


There's a refactor-Menu for renaming classes and functions, so the refactoring should be pretty easy. But I'd go the other way around and rename the stable application once on your phone instead of renaming every build you do - that way, you only have to rename the stable application once you want to update to a new stable version.

At university, we had a similar problem and built a small build-script, which would copy and rename libraries, etc. to the appropriate location (in our case, we wanted to handle iOS and Android-builds from the same source, so the build-script had to build some configuration files from configuration templates, too). Unfortunatly, Eclipse does not provide an easy way to define pre-build scripts via a project's options or something similar (as VisualStudio does).


You can do this easily with the maven Android plugin. Of course, it carries the additional overhead of having to use maven just for this purpose, but it's super easy, and you don't have to move ANYTHING around.

  <properties>
    <androidManifestFile-location>${project.build.directory}/AndroidManifest.xml</androidManifestFile-location>
    <outputApk>${project.build.directory}/${ota-dir}/${application.name.forapk}-${project.version}.${project.packaging}</outputApk>
    <debug-signing>false</debug-signing>
    <android.renameManifestPackage>${target.package}</android.renameManifestPackage>
  </properties>

As long as the ${target.package} keys are different between "installations", you can install the apps side by side.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜