问题描述
我创建了一个 Android 项目来构建我的自定义小部件,我想将它导出为其他项目的 jar 以便方便地重用它们,但现在的问题是,我无法使用包含在我的自定义中的资源小部件 jar,例如 png 图片,它从 R 类的资源 Id 中获取空值!我怎样才能解决它?
更新问题:
如何从代码中的资产文件夹解析 LayerDrawable xml?
I create an Android project for build my custom widget, and I want to export it as a jar for other project so that reuse them conveniently, but now a problem is, I can't use resources which is included in my custom widget jar, for example a png picture, it gets a null from the resource Id of class R! How can I sovle it?
Update question:
How can I parse LayerDrawable xml from assets folder in code?
推荐答案
您目前无法导出自包含的 Android 库 jar,并宣布将在未来的 SDK 版本中提供.
https://developer.android.com/guide/developing/projects/index.html#LibraryProjects
You cannot export self-contained Android Library jar at this time and announced will be available in the future SDK release.
https://developer.android.com/guide/developing/projects/index.html#LibraryProjects
这篇关于Android如何导出带有资源的jar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!