Prehistory
Starting from January I’m working for a company called GetSocial. We are focused on powering more engagement, players and revenue for games by providing easy-to-integrate social building blocks. We already have Android and iOS SDK published, and my first task was to build Unity SDK on top of native ones.
Actually an issue
Recently I found that non-java resources (e.g. images, properties, xml configurations) from included jar libraries are not copied to the final apk during Unity Android build. As a result as soon as we try to load them from a java side - application crashes with I/WindowState﹕ WIN DEATH: Window...
exception.
During native Android SDK development, we had the similar issue but it was easily solved by additional gradle configuration. In the case of Unity there is no easy way to modify apk build process. For sure you can make some magic with apk decompilation, modifying and packaging back, but that’s not the solution we’re looking for.
Here is a simplified diagram for Android apk build process:
Temporary solution
For a temporary solution, there are two approaches:
Magic with Android SDK. Create a wrapper for
apkbuilder
tool and add missing resources in this step. This approach could be the only way if you don’t have access to library source code.Hassle with source code. If you’re missing configuration files and have access to source code, it’s possible to hardcode values directly to java code to remove all references to resources.
External discussion
Check out the issue discussion on Unity Community Forum and FogBugz Unity bug tracker.
Demo
I’ve created a small demo to show off the problem. It consists of 2 parts:
Download demo Unity project from here.
Share with: LinkedIn • Twitter • Facebook