0

I was playing a game that had hidden achievements and wanted to find the conditions necessary to unlock these achievements. To do this, I've tried to get the source code of the game, to find the achievement trigger. The PC version of the game seems to have been written in C++, making the decompiled code near unreadable. So, I got the APK for the android version of the game, and managed to convert the classes.dex file into a jar, which I have now decompiled into readable code. The problem is, there was no code for the classes I was looking for. I don't think any of the code I've seen even relates to the sort of game features I want, having more to do with file and asset management than player control, stat records, NPC behavior, or events. I asked a question about this on a different Stack Exchange site, but have since done a bit more research. It seems that, when the APK is installed onto a device, it requires an internet connection, in order to download all of the other files necessary for the game to run. Is there a way I can gain access to these files? I'm pretty sure that they are in the persistent internal storage directory for this app.

1 Answer 1

1

Best way to access app internal (persistent) storage directory is a rooted device. Once you have root permissions you can access the app internal directory which is located in /data/data/<app packagename>

On an unrooted device you don not have direct access to the app internal (persistent) storage directory.

If the app allows backup (most apps do not) via adb backup <packagename> then you can get indirect access to the app internal storage directory.

Note that Google has limited adb backup on Android 12+: It only works for apps that have a targetSdkVersion of less than 31. App data of app that have targetSdkVersion 31+ are excluded from backup, the backup will stay empty for such apps.

  1. Make sure debugging is enabled on phone and Android SDK/adb is installed on your PC and the phone is connected via USB to the PC
  2. On the connected PC execute adb backup <packagename> this will backup all app data to an encrypted backup.ab file.
  3. If the created backup.ab file has a size of 0 bytes then backup is disallowed for the selected app
  4. If the backup.ab file has a size greater 0 you should be able to decrypt and convert it to to a TAR archive using Android Backup Extractor (abe)
  5. Extract the created tar file and you should have all data stored by the app in it's internal storage.
3
  • Thank you for the help. I tried doing as you suggested, and the resulting app data on the extracted tar file did not have all of the data that I wanted. To put this into perspective, the app on my phone takes up more than 800 MB of space. The data for the app stored within the extracted tar file take up less than 60 MB of space. Will I just have to root the device? And is it possible to do the rooting on some sort of emulated device, in order to get the files I want?
    – Michael
    Commented Jan 20, 2022 at 3:48
  • Okay, so I got a rooted emulator with the app on it, and managed to dig through the files until I found a .OBB file that had everything I wanted in it. That was pretty good, but the thing is filled with generic garbled file and resource data. My plan is to take these files tomorrow and find some way to decompile, or decrypt, or whatever, them into something useful. How I'm going to do that is pretty hazy, so if anyone sees this and has suggestions, I'm open.
    – Michael
    Commented Jan 20, 2022 at 5:46
  • @Micheal Your question was only about the data files crated by the app. OBB files are AFAIK not downloaded/created by the app but from Google Play Store/Play Services. If you just want the app code it is usually easier to check web sites like apkpure.com or apkmirror.com - often they have the complete app package available for download.
    – Robert
    Commented Jan 20, 2022 at 8:24

Your Answer

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

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