on the Android developer site: source at http://developer.android.com/tools/projects/index.html , section in library projects:
"... Structurally, the library project is similar to the standard Android application project. For example, it includes the manifest file in the root project, as well as src /, res / and similar directories. The project may contain the same types of source code and resources as the standard An Android project saved in the same way, for example, the photographer code in the library project can access its own resources through its R class.
However, the library project differs from the standard Android application in that you cannot compile it directly into your own .apk and run it on your Android device. Likewise, you cannot export a project library to a standalone JAR file, just like for a true library. Instead, you should compile the library link library in the dependent application and create the application.
When you create an application that depends on the library project, the SDK Tools will compile the library into a temporary JAR file and use it in the main project, then use the result to generate the .apk. In cases where the resource identifier is defined both in the application and in the library, the tools ensure that the resource declared in the application takes priority and that the resource in the library project is not compiled into the .apk application. This gives your application the flexibility to use or override any resource behavior or values โโdefined in any library.
To organize your code further, your application can add links to several library projects, then indicate the relative priority of resources in each library. This allows you to build up the resources actually used in your application in a cumulative way. When the two libraries referenced by the application identify the same resource identifier, the tools select the resource from the library with a higher priority and discard the other.
Once you have added links to library projects to your Android project, you can set their relative priority. During assembly, libraries are combined with the application one at a time, starting with the lowest priority - the highest.
Library projects can reference other library projects and can import an external library (JAR) in the usual way .... "
I encountered a similar problem when using the Rajawali library (version 0.9). It was necessary to distribute the file. A single jar and applications will use this JAR to display 3D screens. The problem was that there was a setting in our library that used Rajawali library resources. Thus, two project structures were created (for example, a library project). When generating. The JAR application that used the resources did not work for the reasons you explain above), this is because the library uses Rajawali image properties to load identifiers that were not recognized in the version of the target application.
The solution to a single JAR can be verified by changing the code to not use Rajawali resources through R.raw.X (Android approach), to use the resources of the / folder, and force the component to use the Rajawali AsseptManager to open Resources. The solution was exported to a JAR folder with internal assets / and bytecode (. Class) and our Rajawali LIB.
Fat-JAR Eclipse Plugin (or 0.0.31 +) [update the site http://kuruczgrafika.de/fatjar] can generate one JAR and use it in the target application. ANT script was used to run the XML below and a JAR file was created. The file "lib3d_NAME_HERE.jar" (.JAR) will be generated in the file / build / lib 3d_NAME_HERE.jar
<?xml version="1.0"?> <project name="lib3d_NAME_HERE" default="main" basedir="."> <property name="projectPath" value="D:\Development\lib3d_NAME_HERE"/> <target name="main"> <fatjar.build output="build/lib3d_NAME_HERE.jar"> <fatjar.manifest/> <fatjar.filesource path="${projectPath}/bin/classes" relpath=""/> <fatjar.filesource path="${projectPath}/assets/" relpath="assets"/> </fatjar.build> </target> </project>