Tareq Sha
Tareq Sha

Reputation: 516

Use resources from prebuilt JAR in android

Hi,

I am patching the android platform. I have succaessfully included a prebuilt JAR in the build of the platform, and the classes load and work as expected.

My issue is that the JAR itself includes resource files and the clasess use them. This fails during runtime (ClassLoader.getResource() and ClassLoader.getResourceAsStream()). I've searched the web and found that Android allows resources only in package builds (.apk) and doesn't allow for JARs.

My question is: How can I bunlde the resources alongside the JAR? Can I create an APK build and use code inside of it like a JAR? I have all the source and resource files at hand. Currently I signify other platform projects to depend on my JAR with:

LOCAL_STATIC_JAVA_LIBRARIES := my-prebuilt-module-name

and this works. All left is bundling the resources too...

Thanks a lot

Upvotes: 1

Views: 1688

Answers (1)

Cheryl Simon
Cheryl Simon

Reputation: 46844

I think you are looking for a library project. This allows you to import code and resources into multiple Android apps.

Upvotes: 2

Related Questions