The other problem I have is that I have multiple jar files that I
import into my project and all of them have resources (e.g.
strings.xml). Eclipse / Android tools complains about duplicate
strings.xml files while building the apk - Is there a way to overcome
this?

Rohit


On Apr 21, 4:46 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> Add a prefix. As I wrote on this thread earlier:
>
> >> 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.
>
> Also, for any resources you refer to in the binary-only library this
> way, you will need to use reflection or getIdentifier() to get the ID
> value. Any pre-compiled R.* constants will be wrong. This limitation
> is only for binary-only libraries -- traditional source-based Android
> library projects will have their R values work properly.
>
>
>
> On Thu, Apr 21, 2011 at 7:36 PM, Rohit <mord...@gmail.com> wrote:
> > I have the same problem. I want to package in the res folder as well -
> > which I can in the jar file. However, when I run the code the wrong R
> > file is referenced and as a result the wrong resource is referenced
> > which causes all sorts of problems. Is there a way to mark my R files
> > with a namespace so that there is no confusion about which resource
> > file I am referring to?
>
> > Rohit
>
> > On Apr 15, 4:06 am, Mark Murphy <mmur...@commonsware.com> wrote:
> >> 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-eclip......
>
> >> 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/commonsguyhttp://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
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android Training in London:http://bit.ly/smand1,http://bit.ly/smand2

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