针对Android prebuilt JAR利用资源资源、Android、prebuilt、JAR

2023-09-06 21:57:34 作者:不用说了我知道我很帅

的的

我修补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.