- Home /
How to add .properties files to apk root programmatically?
I'm having an issue with the SamsungApps inApp purchase library (plasma). The code works as expected, but it looks that Unity is dropping all the localization files of the plasma.jar when building the apk.
Plasma library uses .properties files placed under a "l18n" folder in the apk root. I was able to check it by unpacking the apk generated by the sample code distributed with the SDK. The apk I build with unity misses the l18n folder and the dialogs only present me the string used as id.
I cannot alter the plasma sdk to use another localization method, so I'm trying to add the l18n folder in my apk through unity.
I resolved the issue by creating a custom PostprocessBuild script that adds the files and resign the apk. I will post it as soon as it's in a clean state.
I've used the Ionic Zip library ( dotnetzip.codeplex.com ) to open and edit the apk without extracting in the PostProcessBuildPlayer callback. After manual edit, it will also require to clean the sign files before saving by deleting the contents of $$anonymous$$ETA-INF directory.
Then jarsign and zipalign again to have a working apk.
ps. This dll is very useful and complete for "inline" archive edit, but I found there is a small issue on directory paths on OSX (there's already an open ticket), so it's better to use AddFile in a foreach loop than AddFolder if you work in a multiplatform environment.
Hope this's useful. If still in trouble, just ask for more.
Answer by $$anonymous$$ · Oct 01, 2012 at 03:19 PM
@dcariola , any updates? Btw, would you consider sharing the plugin or putting it to asset store?
Take a look at the last comment, hot this helps. The plugin is not ready to be shared, cause I'm fixing it to have a common interface through all the IAP plugins I'm working on.
Answer by sz-Bit-Barons · Apr 14, 2014 at 04:48 PM
How about now? is your code doing what it should do? And is it possible with "split application binary" enabled?
Would be nice if you could share your work :)