7

I'm reverse engineering an android application. It's been a while since I've poked with this but I"m having an issue editing the APK to deal with some language areas.

The original app is from a different country. When decompiling and recompiling, the app installs but errors out when you try to run it on the phone. This includes if I only do apktool d and then apktool b. via log cat I'm getting this exception:

Caused by: java.util.MissingResourceException: Can't find resource for bundle 'j.bc.l.resources.resources.resources_en_US', key ''

from a ResourceBundle.getBundle call. Via this page I'm assuming it's an issue related to resolving resources for different languages.

I think the issue is it's defaulting to search a path that doesn't exist in the application, so it can't find the file and the application crashes. I unzipped the apk file and in j.bc.l.resources there is a resources.properties file, but no resources_en_US directory to search in.

So at this point since I need to make changes to the application I'm assuming I need to put a resources_en_US in that directory with a new properties file, but I don't know how to patch that into the application. I can't unzip and rezip because as far as I know it messes up the headers so that apktool and installation will fail.

So I need a way to put the resources.properties file into the correct location to resolve properly. The aren't any references in the code to resources_en_US so I'm assuming the only way to get it to work is to patch the directory into the app and rebuild it. But if there's an easier way to solve this issue I would be okay with that as well.

4
  • 1
    Bottom line - APK is an archive You may extract files from, add files to and perform all other things. So just use Your favorite archive manager to open it and add to APK whatever You need. Oct 12, 2013 at 19:18
  • I'm aware of that, but as I said in the second-to-last paragraph attempting to resign and install it after adding files fails. I get INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES which as of now I'm assuming is because I have different certs than the original. This could be how my app specifically was compiled or because this is an assessment and I don't have the original certs, but in either case unzipping adding files and rezipping doesn't get me anywhere.
    – Fewmitz
    Oct 12, 2013 at 22:53
  • 2
    Could you try resigning the APK with the debug key? Oct 13, 2013 at 14:17
  • That worked and everything installed properly. Thanks to both of you. I'll put a formal solution and close the question
    – Fewmitz
    Oct 13, 2013 at 20:44

1 Answer 1

8

In order to get this to work I had to use a combination of the comments left on my original post. As I mentioned in the topic the issue looks like it being and issue with resource bundles not being included properly. My best guess is the original compilation settings were such that the default resource bundle is different than what's documented here. Whether that's an issue with language compatibility or just something that Eclipse (or whatever they used to build) does behind the scenes.

In any case I took the resources.properties file out of resources\ and copied it into resources\resources_en_US, per the Exception that was being thrown. The constants/parameters that the app was reading from the properties file didn't look like anything special (and were all in English) so I didn't have to make any changes to it.

After that I deleted the META-INF folder per here, then rezipped and sign with the default debug key:

jarsigner -sigalg MD5withRSA -digestalg SHA1 -keystore debug.keystore theApp.apk androiddebugkey

After that everything was kosher, so it was just a matter of combining everything in the right order.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.