Java 库 (.jar) 以及 Android 项目中的资源

Java library (.jar) with resources in Android project

我想在 Android 项目中使用常规 Java 库。该库的 .jar 包含库内部使用的资源(文本文件),即它通过 .jar 中的相对路径访问这些资源。

但是,如果我 运行 应用程序在 Android 设备上,我会收到 IOException 告诉我找不到相应的资源。

在 Android Dalvik VM 上 运行 时,是否可以让库访问其资源?如果是这样,我必须在我的项目中指定什么?

很遗憾,无法完成。 "In general you cannot distribute your own package as easily as you would expect. The main problem is the autogenerated R file. You probably make some references to it - you have your layouts and drawables. User of your library will have his own R file - containing ids for his resources, not for the ones your library provides."(来自This SO answer