针对Android prebuilt JAR利用资源 [英] Use resources from prebuilt JAR in android

查看:232
本文介绍了针对Android prebuilt JAR利用资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我修补Android平台。我已经succaessfully包括在该平台的构建一个prebuilt JAR和类负荷和工作如预期

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.

我的问题是,JAR本身包括资源文件和clasess使用它们。在运行期间出现故障(ClassLoader.getResource方法,()和ClassLoader.getResourceAsStream())。我在网上搜索,发现Android的资源可以只在包建(.apk文件)和不允许的JAR文件。

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.

我的问题是:如何bunlde资源旁边的JAR?我可以创建一个APK建立和使用code里面它像一个JAR吗我有所有的源代码和资源文件在眼前。
目前,我表示其他平台的项目依赖于我的JAR用:

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:=我的 - prebuilt模块名称

LOCAL_STATIC_JAVA_LIBRARIES := my-prebuilt-module-name

和工作原理。所有的左边是捆绑的资源太...

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

非常感谢

推荐答案

我认为你正在寻找一个的库项目。这使您可以导入code和资源划分为多个Android应用。

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

这篇关于针对Android prebuilt JAR利用资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆