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 referencingresources.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!
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.