How To Embed A Save File Into Your APK

Sbenny.com is trusted by 1,313,318 happy users since 2014.
Register

Axiom

G̴̠͂l̶̙̋ȉ̷̲t̷̰͂c̶̮͊ȟ̶̪ê̵͙d̷̰̿ ̴͉̈Ơ̵̟u̵̮̕t̵̼̊
From the Hell
SB Mod Squad ⭐
VIP
Member for 8 years
Greetings, ladies and gentleman. Today I'm gonna show you how to embed a save file into your apk.
This is a pretty simple thing to do. It does require some trial and error and doesn't work for all games.
But with some time and patients you can get this to work on most games.

The first thing we are gonna cover is what tools you will need to do this. All links will be in the tutorial below.

1.Something to decompile your APK. Like APK Tool or Quick Mod. There are many tools, some for android, some for the PC. I use PC tools so this tutorial will follow that & I will be using "Quick Mod" To decompile & recompile my APK
2. Notepad++ : To edit the smali files
3. The Embedded Save Mod File Pack {Which includes this tutorial and all files needed to modify your smali code.}
4. 7zip
5. A PC
6. The Save Data for your game. {sometimes requires Root, if the save data is on the root. This tutorial covers the root way.}
7. Time and Patience

The tutorial that taught me how to do this used "Tap The Frog" as a starter game, but I don't like that game so I will be using Zenonia 2. Yeah I know it's an old game, but I will include a Clean copy of the APK so you can try this on that game first to get a feel for this tutorial.

NOW! ON TO THE GOOD STUFF! THE LEARN YOU SOME KNOWLEDGE STUFF!

Step 1: Download and Install All Needed Files.
QuickMod4.0.rar - 4.5 MB
NotePad++6.8.8.Installer.exe - 3.9 MB
Embedded SaveFile ModPack.rar - 4 KB
Zenonia_2_CleanAPK.apk - 11.2 MB
Code:
http://www.7-zip.org/download.html
Download the proper one for your PC

Step 2: Place Zenonia 2 APK in the "add_apk_here" folder inside the "QuickMod4.0 Folder.


Step 3A: Run "Tool" as Admin & Select "Yes" when prompted.


Step 3B: You will now be presented with this screen and these options.


Step 4: Select "Option 9" and set the size to "1024"


Step 5. The APK Title should be at he top, select "Option 1" now to Decompile the apk. Wait for it to finish.


Step 6: Now go back to the QuickMod Folder and go under "working" Then into the game folder and locate the "AndroidManifest.xml" file


Step 7: Place the "AndroidManifest.xml" file into Notepad++ and look for "androidname=" The name that follows is usually the smali file that you need.
{Sometimes it may differ in place and there may be more than a few lines that are similar, if that happens, then trial and error are the key.}



Step 8: Now you will need to locate the location of the "Zenonia2Launcher.smali" file. In this case it is under "working\Zenonia_2_CleanAPK.apk\smali\com\gamevil\zenonia2" Place the "Zenonia2Launcher.smali" into Notepad++


SideSteps: Extract the files from the "Embedded_SaveFile_ModPack" to your desktop or where ever you like.Now depending on where the games saves its data will depend on which method you will need to use. either {data/data on the Root of your device or SDcard/Android} Gamevil saves it under "the devices root "data/data" So this is the one we will use.


Place both files labeled "Code 1" & "Code 2" into Notepad++ | So now you should have 4 files loaded into Notepad++. The AndroidManifest, the Smali File & Both Code Files.
Got to Code 1 and copy the text. Now go to the Zenonia2 smali file, locate "# direct methods" and paste what you just copied directly under it, like so.


Now go to "Code 2" and copy that line and now locate ".method public onCreate" in the Zenonia2 smali file and paste it accordingly. Below the onCreate line and above .prologue Once done, Save it. Now we're done with smali editing.
If you're doing a different game than Zenonia 2 you will need to change 3 additional lines in files Code 1 & 2. Will be explained at the end.


Step 9: In the folder with the Code 1 & 2 files, there is a "Esdata" file. copy that to the games "assest" folder which should be something like "QuickMod4.0\working\Zenonia2_CleanAPK_Paid.apk\assets" Now I'm assuming you have "7zip" installed & you have the data files from your phone, which for this game would be under "data/data/com.gamevil.zenonia2" All the files in that folder should be copied to your desktop, so that you can copy them into the "ESdata" file.
Right click over the ESdata file and select "7zip" and open it, now drag all the game files as they are into that file.


Ok. So now we should have copied code 1 & 2 into the smali file and copied the game data into the ESdata file and moved it to the games asset folder.
For those modding Zenonia 2 Continue to step 10, for those modding a different game read below for the other lines that need changing.

In the files code 1 and code 2 this line appears 3 times. "Lcom/gamevil/zenonia2/Zenonia2Launcher" It is there because this tut is for Zenonia 2. To use it for a different game you will need to change that line to the game you are modding. The line you will need is in the smali file of the game you are modding. Once you locate the smali that you need to mod. The first line at the top that starts with ".class public Lcom/gamevil/zenonia2/Zenonia2Launcher" you will need to copy just from the "Lcom" part to the end of the games title and paste over the Zenonia lines.


Step 10: Now we should have all the files modified that we need lets triple check. Both "Code 1 & 2 files" copied correctly and lines changed if modding another game. Game data files with folders copied into ESdata file. ESdata copied to games asset folder. If all is save and good. Go to QuickMod and select option 2 to Compile APK. If all goes well it will finish without error. If it errors, check your work, you may have misplaced a line or deleted something. Even if it finishes without error doesn't mean it worked. Sometimes it will finish right even if you have the wrong smali file, so this is where trial and error comes in as well.


Step 11: Select Option 3 and sign your apk. Once it finishes go to your QuickMod folder and go under "compiled_apk" then into the game folder. There should be 3 files as it creates one each time it does something. copy the one that says "signed" to your device and try it out. If it works you got it right. If the game fails to install or crashes upon opening, you messed something up. go back and check your work.


So that's it guys. I hope this helps and if you have any questions, post them and I will do my best to help. This does not work on all games and some newer games, hide the proper name in the AndroidManifest or even encode it. Be patient and keep trying. If you know something I forgot or get stuck, just leave a post.

*Note: If the control pad in the game is off or in the middle of the game, go under settings, select Dpad and realign them.

Best of Luck,

Axiom

:dragon:
 

Raxx

Veteran Lv7️⃣
eBook Releaser
Member for 8 years
Re: Tutorial How To Embed A Save File Into Your APK

Wow! That's amazing! Great job! :)
 

Sbenny

A crazy scientist
Staff member
Admin
SB Mod Squad ⭐
✔ Approved Releaser
Active User
Re: Tutorial How To Embed A Save File Into Your APK

Thanks for granting my wish Axiom! You're awesome! This tutorial is so detailed, I'm impressed =)
 

Sbenny

A crazy scientist
Staff member
Admin
SB Mod Squad ⭐
✔ Approved Releaser
Active User
Check the file TutorialActivity.smali, probably you mistyped something.
 

lasercrafter

Lurker Lv0️⃣
Member for 7 years
I tried it again, but I have the same issue. Should I send you the complete source?
 

Gourov

Dimitri Petrenko
✌️ Community Team
Member for 5 years
It's not seems to be very hard. Practice is the key. But need a computer First. Or can do in android too . But root required.... 😑
 

a375

Apprentice Lv2️⃣
Member for 5 years
Are all these files obsolete? Can you repost Axiom or someone?
 
Last edited:
Top