On Fri, Apr 15, 2011 at 3:03 AM, Dan <dan.schm...@gmail.com> wrote:
> I have a nice .apk with a service and 4 activities, a shared native
> library with some jni goodness, some drawable files in the res
> directory and some other data in the assets directory.   Another
> company would like to package the functionality of my .apk along
> with their .apk so the user only has to make one download.
>
> I would like to take their money with as small amount of work for
> myself and their engineers as possible.

How are you with a gun? You'll get free wallets along with the money that way.

:-)

> My current solution is to
> send them a .zip file with all my classes, the assets, the resources,
> and the native .so library, and the manifest, and my .mk files and
> have them copy bits of the manifest into theirs, put the resources
> and assets next to theirs, do the build process so the new R.java
> is generated and then compile all my classes.
>
> I would prefer not to give them the source code to my classes, but
> the resources in R.java make that rough.  I do my builds through
> ant on the command line, they use eclipse so there tends to be
> some finger pointing when some functionality doesn't work.  Is
> there a better solution than what I am currently doing and where
> would I look for the details of what sort of things will bite me when
> trying to pack files in a jar for someone else to reuse?  (E.g. is
> there a workaround for providing a drawable ID for a notification?)

Well, the best answer would be an Android library project:

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

I do not know how well that handles NDK stuff, and my memory is fuzzy
on assets. The rest would be no problem.

Initially, you will wind up with stuff that will look like that you
need to ship Java code. However, there are workarounds for that.
Quoting myself from one of my books:

"Android library projects are designed for distributing source code.
That may or may not be palatable in all cases. You can create a
binary-only library project via the following steps:

-- Create an Android library project, with your source code and such —
this is your master project, from which you will create a version of
the library project for distribution

-- Compile the Java source (e.g., ant compile) and turn it into a JAR file

-- Create a distribution Android library project, with the same
resources as the master library project, but no source code

-- Put the JAR file in the distribution Android library project's
libs/ directory

The resulting distribution Android library project will have
everything a main project will need, just without the source code."

You may also want to use some sort of unique prefix on your resource
files and names, so that you do not accidentally collide with a
project that is using your library.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Warescription: Three Android Books, Plus Updates, One Low Price!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to