包装绘制资源与JAR? [英] Packaging drawable resources with a JAR?

查看:121
本文介绍了包装绘制资源与JAR?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经建立了一个半推送服务(签入从一个集中的HTTP服务器通知),我想发给了几个朋友和客户,这样他们就可以轻松添加推送般通知他们的应用程序没有太多麻烦。

我已经得到了足够远的打包JAR并将其包含在我的一些其他项目,但现在我打砖墙关于资源包装 -

  • 在我PushNotify的项目,我有一个资源:R.drawable.goldstar
  • 在我画这两次申请,一旦通过引用 R.drawable.goldstar ,一旦通过引用 resources.getIdentifier('金星' ,绘制,com.com.pushnotify')
  • 当我打包PushNotify作为自己的APK,金五星正确地出现在这两个地方。
  • 在我右键单击在Eclipse中,出口项目,为JAR文件,从包含的文件取消勾选ApplicationManifest.xml,然后单击完成。
  • 我可以验证这个JAR文件的大小增加时,添加更多可绘制的资源。
  • 当我再打包DependantApp.apk,包括PushNotify.jar在构建路径,金五星正确地出现在这两个地方。
  • 如果我卸载PushNotify.apk,黄金星消失的DependantApp.apk因为如果他们不打包的JAR;一个0值,则返回则getIdentifier('金星','绘制','com.com.pushnotify')

我如何分配与可绘制资源的JAR,并让他们出现在相关的应用程序?应用程序,包括我的JAR永远需要访问我分配的图标,只是我自己的code一样。

尽管很多反对,说在搜索结果中我找到,我敢肯定这是某种可能的,因为:a)我的JAR文件的增长,当我添加新的图像,和b)我已经附带前图标( Airpush做到这一点,因为确实UrbanAirship )。

包含的JAR文件

在此先感谢!

解决方案
  

我如何分配与可绘制资源的JAR,并让他们出现在相关的应用程序?

这是不是presently支持。创建的Andr​​oid库项目,可以分配资源的工具路线图和有望走出来,在不太遥远的将来。

I've built a semi-push service (checkins for notifications from a centralized http server) that I'd like to distribute to a few friends and customers, so they can easily add push-like notifications to their apps without much hassle.

I've gotten far enough to package the JAR and include it in a few of my other projects, but now I'm hitting a brick wall with regard to resource packaging --

  • In my PushNotify project, I have a resource: R.drawable.goldstar
  • I draw it twice in the application, once by referencing R.drawable.goldstar, and once by referencing resources.getIdentifier('goldstar', 'drawable', 'com.com.pushnotify')
  • When I package PushNotify as its own APK, the gold star correctly appears in both places.
  • I right click in eclipse, Export Project, as JAR file, un-check "ApplicationManifest.xml" from included files, and click "Finish".
  • I can verify that the size of this JAR file increases when I add more drawable resources.
  • When I then package DependantApp.apk, including PushNotify.jar in the build path, the gold star correctly appears in both places.
  • If I uninstall PushNotify.apk, the gold stars disappear from DependantApp.apk as if they were not packaged with the JAR; a 0 value is returned for getIdentifier('goldstar', 'drawable', 'com.com.pushnotify').

How can I distribute a JAR with drawable resources, and have them appear in the dependent apps? Apps including my JAR never need to access the icons I am distributing, only my own code does.

Despite much nay-saying on in the search results I find, I am certain this is somehow possible, because a) my JAR file grows when I add new images, and b) I've included JAR files that come with icons before (Airpush does this, as does UrbanAirship).

Thanks in advance!

解决方案

How can I distribute a JAR with drawable resources, and have them appear in the dependent apps?

That is not presently supported. Creating Android library projects that can distribute resources is on the tools roadmap and will hopefully come out in the not-too-distant future.

这篇关于包装绘制资源与JAR?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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