Android如何用资源导出jar? [英] Android how to export jar with resources?

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

问题描述

我创建一个用于构建我的自定义窗口小部件的Android项目,并且我想将其作为其他项目的jar导出,以便方便地重用它,但是现在的问题是,我无法使用我的定制中包含的资源窗口小部件的jar,例如png图片,它从类R的资源ID获取null!我该怎么办?


更新问题
如何从代码中的资产文件夹中解析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 Library 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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