Android : Using single jar with both armeabi and armeabi-v7a libraries

on Tuesday, August 12, 2014


I have an Android app that includes a native library (called fa) that we've compiled for both armeabi and an armeabi-v7a. We have libfa.so files for each of these in subdirectories named for the architecture in the project's libs area, i.e., <project>/libs/armeabi/libfa.so and <project>/libs/armeabi-v7a/libfa.so.


We also have a .jar file that we want to include called facore.jar. My assumption was that we could just put this (once) directly into the libs folder, e.g., <project>/libs/facore.jar. But when we do this, although it works fine when we build from the command line using ant, when we try to build from within an Eclipse ADT project, we get errors like the following:



[2014-08-13 01:18:12 - FAActivity] WARNING: unable to write jarlist cache file [clipped]/bin/jarlist.cache
[2014-08-13 01:18:54 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/[clipped];
[2014-08-13 01:18:54 - FAActivity] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/[clipped];


However, if we make a copy of facore.jar in both the armeabi and armeabi-v7a subdirectories, things seem to work ok in Eclipse ADT. Until now, that's how we've been proceeding when we want to debug with Eclipse ADT.


However, recently when we started using Proguard on the project, it complained about having multiple copies of this jar file around. While I imagine I could probably work around this by mucking around in my Proguard configuration file, I would rather understand why Eclipse ADT needed these (seemingly) redundant copies of facore.jar in the first place and, if possible, only have one instance of that file in the libs folder.


So I have two questions:



  • Why does Eclipse ADT give the above errors when facore.jar is only in the libs folder?

  • Is there a way around that without making multiple copies of facore.jar, one for each architecture that we compile the .so for?


0 comments:

Post a Comment