[GUIDE] How to enable adb backup for any app changing android:allowBackup - Android Software/Hacking General [Developers Only]

Some applications can't be backed up by adb backup because the option is disabled on the AndroidManifest.xml of the apk. To workaround this, it is required to set android:allowBackup to true in the AndroidManifest.xml.
The application I will be patching is Signal Private Messenger, which by default doesn't allow adb backups (security reasons, I guess). Also, it's an open source application:
Signal Private Messenger (Play Store)
Signal Private Messenger (GitHub)
CHECKING FLAG_ALLOW_BACKUP
The first step is to check if the flag FLAG_ALLOW_BACKUP is present. It can be done several ways, but the easiest one is to use System Info for Android or System Info Pro for Android to check the flags of any desired application. Of course using Windows or Linux you can use script to auto-check for any number of apks.
You will see that in the app "Signal Private Messenger" the flag is missing with the official version:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Analyst also displays FLAGS per app. In this screenshot you can see Signal already patched:
APK EASY TOOL (WINDOWS APPLICATION)
To decompile, compile and sign the modified apk, the APK Easy Tool is the best to go, all in one with no complication. It requires java SDK installed and "java" and "javac" to be present on your PATH:
[TOOL] APK Easy Tool v1.2 for Windows (GUI tool, friendly)
Once you've executed "APK Easy Tool v1.2.exe", go to Options and configure "Decompiled directory" and "Compiled directory". You can just hit "Setup directories for me" and the folders will be set automatically to default locations:
Then go to the main tab of the program and leave checked "Sign APK after compile". Hit "Select" on "APK File to work on" and Decompile:
Now on your "Decompiled APKs" folder (you can use directly the button on the main windows of the program), open the file AndroidManifest.xml with a text editor. Notepad++ is highly recommended.
Then replace
android:allowBackup="false"
with
android:allowBackup="true"
After that, save the file and close the text editor. Now go back to APK Easy Tool and hit Compile to build the modified version of Signal Private Messenger. It will be present on the "Compiled directory".
APK EDITOR PRO (ANDROID APPLICATION)
APK Editor Pro is the way to go if you want to edit the file directly on the smartphone. First, you need to get the Signal apk from the smartphone, with some app like APK Extractor Pro.
Open the extracted Signal apk with the apk editor and edit the AndroidManifest.xml. Save and it will automatically compile and sign the new version.
Note that APK Editor Pro is very prone to errors, so it's highly recommender to use the APK Easy Tool instead. Just try and error.
REINSTALL APP
To install on android the patched apk, you must first uninstall your previous version, and this is because the key used to sign the apk is different. If you try to install one app itself with a different signing key, you will get this error: [INSTALL_FAILED_ALREADY_EXISTS]
Now you can see that FLAG_ALLOW_BACKUP is present:
There are some things to have in mind when using apks signed with unofficial keys:
The app will no be updated anymore automatically from Google Play Store or any other store, because you are using a custom key. You must surveil periodically the store where you get the updates, download the newer apk, patch it and update it. The developer may or may not modify flags with future updates.
You can uninstall the patched app at any time to reinstall the official one from Play Store, but you will lose app's data if you don't perform a valid backup before.
Signing keys have an expiration date. The one used by APK Easy Tool is valid for a lot of years so shouldn't be a worry.
The apks generated by APK Easy Tool are not zipaligned, but they will work perfectly the same. The only difference is that they will consum a little more of RAM.
If you modify several apks, it's better to use the same signing key for ease of updating.
OTHER METHODS AND LINKS
There are a lot of methods to decompile, edit, recompile, sign and zipalign apks. I will provide some useful links with other software and development information:
https://developer.android.com/studio/command-line/zipalign.html
http://stackoverflow.com/questions/19543520/zipalign-verification
http://stackoverflow.com/questions/8300822/android-how-to-find-which-platform-version-an-apk-targets
https://github.com/WhisperSystems/Signal-Android/wiki/How-to-build-Signal-from-the-sources
https://shatter-box.com/knowledgebase/android-apk-signing-tool-apk-signer/
[IDE][3.x] APK Studio - IDE for Reverse Engineering Android APKs
Decompile, Edit, and Recompile in One Tool with APK Studio
Idea: Hook "android:allowBackup" in AndroidManifest.xml
[XPOSED][MOD] Backup All Apps
[INDEX] Xposed Modules Collection | Post Modules' Requests Here!
ADB Backup and Restore not all it's cracked up to be.

Is there a version of APK Easy Tool for Mac OS? Thanks!

backup of apps fails despite android: allowBackup="true"
I tried to backup some apps using following ADB-Command:
adb backup -apk -obb -noshared apk.package.name -f C:\Destination\Folder\package_backup.ab
But it didn't work for all my apps.
I started searching for an explanation and a solution for my Problem. Then I found your guide and followed the instructions.
But when I decompiled some of these apps I wasn't able to create a backup, I recognized that some of them had the flag android:allowBackup="true"
Here are a few of these apps (just to name a few):
» app.WTInfoTech.WorldAroundMeLite.apk
» appplus.mobi.lockdownpro.apk
» cn.wps.moffice_eng.apk
» color.dev.com.pink
In reality, there are far more apps than just four.
There are certainly around 40-50 apps that can not be backed up using ADB (even though they have the appropriate flag in the AndroidManifest.xml)
I am using the latest Plattform Tools for Windows (r28.0.1) downloaded from here
Can someone explain to me, why I cannot backup these apps? Even if they have the android:allowBackup="true" flag?
Am I doing something wrong? Or is there some kind of a magic trick that I don't know?
I would be very happy if someone could help me with this problem.

I've been having this problem as well. I noticed that not all apps are backed up using the all flag etc.
I think it boils down to if the app uses a backup agent. Looking at the logcat when attempting to backup ConnectBot using the command adb -apk -obb -f backup.ab org.connectbot It said connect bot is Key-Value and just silently skips it. When using the command adb -apk -obb -keyvalue -f backup.ab org.connectbot It will actually backup some data, but it will not backup the apk.
I don't really have a solution just wanted to share some observations.
Praetoriani said:
I tried to backup some apps using following ADB-Command:
adb backup -apk -obb -noshared apk.package.name -f C:\Destination\Folder\package_backup.ab
But it didn't work for all my apps.
I started searching for an explanation and a solution for my Problem. Then I found your guide and followed the instructions.
But when I decompiled some of these apps I wasn't able to create a backup, I recognized that some of them had the flag android:allowBackup="true"
Here are a few of these apps (just to name a few):
» app.WTInfoTech.WorldAroundMeLite.apk
» appplus.mobi.lockdownpro.apk
» cn.wps.moffice_eng.apk
» color.dev.com.pink
In reality, there are far more apps than just four.
There are certainly around 40-50 apps that can not be backed up using ADB (even though they have the appropriate flag in the AndroidManifest.xml)
I am using the latest Plattform Tools for Windows (r28.0.1) downloaded from here
Can someone explain to me, why I cannot backup these apps? Even if they have the android:allowBackup="true" flag?
Am I doing something wrong? Or is there some kind of a magic trick that I don't know?
I would be very happy if someone could help me with this problem.
Click to expand...
Click to collapse

@dazoe
THX for sharing your knowledge :good:
I'm going to check my logcat as well for these apps adb does not back up
I can give you a short guide on how to extract/backup an apk of a specific package:
1) If you don't know the package-name, you can create a list of all installed packages (sorted in alphabetical prder without app names)
adb shell pm list packages -f | sed -e 's/.*=//' | sort
2) Now look for the desired app you want to extract/backup the apk from. Then run following command:
adb shell pm path com.example.someapp
You will get an output which will look something like the following:
package:/data/app/com.example.someapp-1/base.apk
3) With this information you can simply perform a pull-command like the following:
adb pull -a -p /data/app/com.example.someapp-1/base.apk C\LOCAL\PATH\TO\YOUR\BACKUP\com.example.someapp-1/base.apk
Hope that I could help you with this little guide

I patched the apk I want to backup, but before I uninstall the original and install the patched, are there any other methods that will allow me to restore my original appdata? Since uninstalling the original will remove that appdata. I'm not rooted.

so whats the point if you have to uninstall the app and reinstall using the new apk? itll wipe the data of the app you're trying to back up
is there any way to do this without wiping?

.

lebigmac said:
I ran all of the commands below to uninstall the app in question while keeping my data which I want to backup:
Code:
adb shell pm uninstall -k --user 0 my.app.name
adb shell pm uninstall -k my.app.name
adb shell cmd package uninstall -k my.app.name
adb uninstall -k my.app.name
These commands probably all call the same procedure under the hood but I just wanted to make sure the app really gets uninstalled. So either one of these commands should do the job.
I guess that part worked and it actually preserved most of my private data.
Now the problem:
When I try to reinstall the modded .apk file I get this error:
Code:
adb: failed to install gen_signed.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package my.app.name signatures do not match the previously installed version; ignoring!]
Click to expand...
Click to collapse
You can only reinstall app with same signature, if there is some data left. If you uninstall totally, you can install with different signature (but you lose data). If you need to get the data you can try to root without formatting.

.

lebigmac said:
Hi @scandiun
How can I root stock HTC U11+ running Oreo without formatting internal storage?
As soon as I unlock the bootloader all data gets wiped!?
I need to backup some important app data before I can unlock bootloader and then install TWRP/Magisk.
As you can see I am in a dilemma. Thanks for chiming in.
Click to expand...
Click to collapse
I have no idea about that phone. Most of times, it's now possible unless there is a bug which allows to gain root access while running android. There are 4 ways that you can try:
Try some app which allows to root the phone temporarily while it's running (without the need for any bootloader unlock). For the LG G2 there was AutoRec and Towelroot.
Request HTC a special update or feature for your device (for your specific IMEI/serial number) so they allow you to update or unlock bootloader without data format.
Contact the app developer and request an update for you with android:allowBackup enabled. If the developer is still alive and is willing to do so, because you just need his signing key. Sometimes it's done by Google servers instead of the developer itself.
Wait for your device to oficially update to android 11, since that version will ignore that flag when syncing all phone data to a new phone. There you could sync to a rooted phone with LineageOS and recover the data. Request HTC to update that device
Android 11 forces apps to support local backups but not cloud backups

Related

HOW TO: Manually backup 3rd-party application settings and data

This tutorial will explain how to backup application data and settings for 3rd-party apps that do not have an export/import settings feature. Looking to upgrade your ROM but don't want to lose your todos/highscores/whatnots after a data wipe? Then read on..
(I've never used apps to SD, so I'm not completely sure how the data is stored with that. I'm assuming the entire data partition is moved to the SD though, so the procedures outlined in this guide are not necessary / do not apply to apps2sd)
Tools needed:
adb
Backing up settings
Run a adb shell in the command prompt and navigate to /data/data
Code:
c:\android-sdk-windows-1.5_r1\tools> adb shell
# cd /data/data
Find the folder of the app whose settings you want to backup. In android 1.5, M/SMS are stored in com.android.providers.telephony and bookmarks are in com.android.browser. For third party apps, you can use ls to list all installed apps and find your app folder manually, or use find - say I want to find the app folder for the Astrid todo app:
Code:
# ls
<.....lots of directories....>
com.timsu.astrid
<.....more directories....>
# find *astrid* -maxdepth 0
com.timsu.astrid
Now open a separate command prompt and use adb pull to copy the application's data folder to your computer. This does not copy the app itself, only its saved data and settings. App .apks reside in /data/apps, which you can also adb pull out if you want. In this example I pull out settings for Astrid:
Code:
c:\android-sdk-windows-1.5_r1\tools> adb pull /data/data/com.timsu.astrid d:\desktop\com.timsu.astrid
Feel free to replace d:\desktop with the location of your choice, of course. Repeat the above for each app folder you want to backup.
Restoring settings after a wipe
First thing to do is reinstall the apk, from sdcard, adb install, market, whatever. After the app is installed, you can restore settings in one of two ways: the easy way or the hard but safe (paranoid) way.
The Easy Way:
This quick and dirty method will give everyone full read/write/execute permissions on the application's settings/data. This is normally a Very Bad Idea with a normal linux computer, but realistically there is very little risk of this posing any real security issues on a device like a phone.
First, adb push the settings into the data folder, overwriting the app's stock settings (in this example, the astrid data I backed up) then adb shell into the phone and navigate to /data/data:
Code:
c:\android-sdk-windows-1.5_r1\tools> adb push d:\desktop\com.timsu.astrid /data/data/com.timsu.astrid
Done
c:\android-sdk-windows-1.5_r1\tools> adb shell
# cd /data/data
Now give full permissions to the app's data folder and its contents:
Code:
# chmod 777 com.timsu.astrid
# cd com.timsu.astrid
# chmod 777 * */*
And that's it. Launch the app and your settings/data should be restored.
The Hard Way
I'm not going to go into this in detail because if you're reading this, you probably know the commands to do this anyway. After you reinstall the app, the general idea is to run ls -l on the stock app data directory and its subdirectories to display the owner and permissions of each file/folder as setup by the android system. Write these down then adb push the backup app data folder in, which overwrites everything with directories and files owned by root. Then use chown and chmod to restore the original owners and permissions for each file and directory. Needless to say this can be quite a hassle if you're dealing with more than a few application backups.
is there any way to backup up wifi wep and wpa keys?
if there was i wouldnt mind wiping, but typing in a 63character long passkey gets very tedious after a while!
Wifi settings are stored in /data/misc/wifi:
-rw-rw---- system wifi 29620 2009-04-29 21:31 wpa_supplicant.conf
ah cool, thank you very much
Excel guide. I tried this before wiping my rom and installing a new one and it worked perfectly for 2 different applications. Great! Thanks!
good idea, can save some time.
Thanks for this
So ...
cyricc said:
Tools needed:
adb
Code:
c:\android-sdk-windows-1.5_r1\tools> adb pull /data/data/com.timsu.astrid d:\desktop\com.timsu.astrid
Click to expand...
Click to collapse
i am just wondering why would you use adb instead of just copying to the sdcard?!?
Code:
# mkdir /sdcard/my_backup_data
# cp /data/data/com.timsu.astrid /sdcard/my_backup_data
this would perform the same function "on the fly" without the need of even having a computer .. maybe add this into the OP?
I just used root explorer to copy the apks to sdcard
LucidREM said:
i am just wondering why would you use adb instead of just copying to the sdcard?!?
Code:
# mkdir /sdcard/my_backup_data
# cp /data/data/com.timsu.astrid /sdcard/my_backup_data
this would perform the same function "on the fly" without the need of even having a computer .. maybe add this into the OP?
Click to expand...
Click to collapse
And you can use "tar" instead of "cp" to also automagically save/restore the correct UID, GID & permissions... or compress data...
Hmm i cud write a batch script to do all this. If theres a huge percentage of windows users here that would like this let me know. Features im thinking of are
1 click backup of all apps or choose from list of apps
launcher icon / wifi settings backup
1 click restore of all apps or specific app
Daneshm90 said:
Hmm i cud write a batch script to do all this. If theres a huge percentage of windows users here that would like this let me know. Features im thinking of are
1 click backup of all apps or choose from list of apps
launcher icon / wifi settings backup
1 click restore of all apps or specific app
Click to expand...
Click to collapse
+1 here!
While these methods work fine, I am never one to reject a streamlined version. Thanks for this OP and Dane.
Scripting
Daneshm90 said:
Hmm i cud write a batch script to do all this. If theres a huge percentage of windows users here that would like this let me know. Features im thinking of are
1 click backup of all apps or choose from list of apps
launcher icon / wifi settings backup
1 click restore of all apps or specific app
Click to expand...
Click to collapse
that's very easy
TAR
joseangel.alv said:
And you can use "tar" instead of "cp" to also automagically save/restore the correct UID, GID & permissions... or compress data...
Click to expand...
Click to collapse
serious? so:
# tar /data/data/com.timsu.astrid /sdcard/my_backup_data/com.timsu.astrid.tar
would do this? or something different? i will look over the syntax myself .. that makes scripting so easy too
TAR
LucidREM said:
serious? so:
# tar /data/data/com.timsu.astrid /sdcard/my_backup_data/com.timsu.astrid.tar
would do this? or something different? i will look over the syntax myself .. that makes scripting so easy too
Click to expand...
Click to collapse
# tar -czf /sdcard/my_backup_data/com.timsu.astrid.tgz /data/data/com.timsu.astrid
this (i guess) would be the correct functioning
Any idea where the homescreen layout is saved ? is it specific to the launcher ur using ?
W/e i think my script covers that by backing up data folder. Alright guys these r the options i have so far. Anything missing ?
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Launcher
Daneshm90 said:
Any idea where the homescreen layout is saved ? is it specific to the launcher ur using ?
Click to expand...
Click to collapse
that would depend on which launcher you have i suppose
LucidREM said:
that would depend on which launcher you have i suppose
Click to expand...
Click to collapse
Correct. Its the database folder within the specific launcher u are using. So in essense by backing up the whole /data folder or just ur specific launcher's /data folder u are preserving ur icons/widget layout.
Ok so here it is :
This assumes adb is in ur path.
Just place .bat file anywhere and run.
TAR
ok .. so i am just a sucker for the obvious i guess .. try this one out:
# lucid -archive
yay me! what this will do is to archive (tar) the whole /data/data folder .. not just one specific app .. then you can restore one part or all parts later (ok .. i did NOT script the restore portion)

[HOW-TO] Stock Apps for All!

After two days of fumbling around with adb, numerous nandroid backups, and ultimately wiping my system, I, with the help of my friend Kiraly (his xda username), have successfully installed the stock Messaging, Clock, Calculator and Browser apps onto my phone.
The Messaging app was of particular interest to me because I hate how the HTC Sense Messaging app always loads briefly when you enter a thread of messages, no matter how many messages are in the actual thread. Also, the stock Android Messaging app has a feature similar to BBM in that an icon within the thread notifies you when a message has actually sent.
By following the instructions contained hereunder, you agree to indemnify and hold harmless the original poster (the "OP"). I hereby disclaim all warranties and liability for any harm that may result by following the aforementioned instructions.
Installing these apps was fairly easy once we found out how it needed to be done. You will need the following:
A. Minimal knowledge of adb, or rather knowledge of how to copy and paste adb commands.
B. You will need full root (root and nand unlocked)
C. 1.47 kernel with the modified default.prop file http://forum.xda-developers.com/showthread.php?p=7138666
D. The Root Explorer app (this can be purchased in the Android Market)
E. You will need the following .apk files from BuglessBeast. They are the only apps that I have been able to successfully install. http://forum.xda-developers.com/showthread.php?t=700175
-Mms.apk
-Browser.apk
-DeskClock.apk
-Calculator.apk
STEP 1
Perform a nandroid backup.
STEP 2
Plug your phone into your computer via USB and mount the sd card.
STEP 3
Download the 1.47 kernel with the modified default.prop file. The stock kernel is also contained in the following link, and you can always revert back to it if need be. http://forum.xda-developers.com/showthread.php?p=7138666
STEP 4
Flash the modified 1.47 kernel .zip file to the root of your sd card (for all you rookies out there, simply drag the .zip file onto your sd card).
STEP 5
Reboot into recovery and install the kernel you just flashed. Then, reboot the phone.
STEP 6
Download the BuglessBeast ROM http://forum.xda-developers.com/showthread.php?t=700175
STEP 7
Unzip the BuglessBeast file. Open the unzipped file. Find the folder labeled "System", and open it. Then, find the folder labeled "App", and open it. Find the files labeled Mms.apk, Browser.apk, DeskClock.apk and Calculator.apk. Drag those files to your desktop.
STEP 8
Download and open the Root Explorer app. Scroll down to the bottom and click on the folder labeled "System." Then, at the top of the app, click "Mount R/W." After you click that, open the "app" folder. Each application has two files you need to delete. Do not delete any of the clock files. You will need to delete the following files and then quit the application when you have finished:
-Browser.apk
-Browser.odex
-Mms.apk
-Mms.odex
-Calculator.apk
-Calculator.odex
STEP 9
Open the Command Prompt if you are a Windows user or the Terminal application if you are a Mac user and navigate to the tools folder of the Android SDK. Do not boot into recovery.
STEP 10
Type the following commands in order. We will use the Browser.apk as an example, and I will assume the file is on your desktop:
Code:
adb shell
Code:
mount -o remount,rw -t yaffs2 /dev/block/mtdblock4 /system
Code:
exit
Code:
adb push C:\Users\YourUserName\Browser.apk /system/app
Code:
adb shell
Code:
chmod 6755 /system/app/Browser.apk
Code:
exit
Code:
adb reboot
STEP 11
Rinse and repeat!
Thanks to frankenstein\ for the kenel, laydros for getting me started in the right direction, BuglessPete for the .apk files, and most importantly to Kiraly for all his assistance.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
<3
10 char
I hope the push command is correct. On my Mac, when the files is on my desktop, the command is:
/adb push /Users/kpoz/Desktop/Browser.apk /system/app
Someone please let me know if the push command is not correct for Windows.
kpoz said:
I hope the push command is correct. On my Mac, when the files is on my desktop, the command is:
/adb push /Users/kpoz/Desktop/Browser.apk /system/app
Someone please let me know if the push command is not correct for Windows.
Click to expand...
Click to collapse
I'm using Ubuntu but I have a Windows lappy around with adb setup, I'll test it out and let you know.
neckface said:
I'm using Ubuntu but I have a Windows lappy around with adb setup, I'll test it out and let you know.
Click to expand...
Click to collapse
Great, thanks. I almost forgot to delete the "./" before "adb" when I was writing the tutorial. For whatever reason, on a Mac the command is ./adb, and on Windows it is simply adb.
kpoz said:
Great, thanks. I almost forgot to delete the "./" before "adb" when I was writing the tutorial. For whatever reason, on a Mac the command is ./adb, and on Windows it is simply adb.
Click to expand...
Click to collapse
Yup, same with Linux.
Just replaced the Sense Mms app with the stock one using this technique and it worked perfectly. Only thing I did differently was rather than deleting the stock files I just renamed them with a *.bak for easy restoring in case I ever need to.
Also I'm using Netarchy's kernel [FPS fix] and I did not need to do all the steps with the default.prop, I was able to mount the system folder with write permission.
And in case anyone is like me and just wants to replace the messaging app rather than all of them, I'll attach the apk for much quicker downloading. Its the apk straight out of the BuglessBeast ROM.
kpoz said:
I hope the push command is correct. On my Mac, when the files is on my desktop, the command is:
/adb push /Users/kpoz/Desktop/Browser.apk /system/app
Someone please let me know if the push command is not correct for Windows.
Click to expand...
Click to collapse
Push command is correct for windows. It may vary slightly depending on where you placed the apk files.
tehpsyc said:
Just replaced the Sense Mms app with the stock one using this technique and it worked perfectly. Only thing I did differently was rather than deleting the stock files I just renamed them with a *.bak for easy restoring in case I ever need to.
Also I'm using Netarchy's kernel [FPS fix] and I did not need to do all the steps with the default.prop, I was able to mount the system folder with write permission.
And in case anyone is like me and just wants to replace the messaging app rather than all of them, I'll attach the apk for much quicker downloading. Its the apk straight out of the BuglessBeast ROM.
Click to expand...
Click to collapse
Glad it worked for you! Thanks for attaching the Mms.apk.
I'm glad that slow, unresponsive Sense Messages app is long gone. You know there is something wrong with your app (*cough, HTC, *cough) when you get a "Loading" message when opening a thread, regardless of how many messages are in said thread.
initial said:
Push command is correct for windows. It may vary slightly depending on where you placed the apk files.
Click to expand...
Click to collapse
Thanks for confirming.
tehpsyc said:
Just replaced the Sense Mms app with the stock one using this technique and it worked perfectly. Only thing I did differently was rather than deleting the stock files I just renamed them with a *.bak for easy restoring in case I ever need to.
Also I'm using Netarchy's kernel [FPS fix] and I did not need to do all the steps with the default.prop, I was able to mount the system folder with write permission.
And in case anyone is like me and just wants to replace the messaging app rather than all of them, I'll attach the apk for much quicker downloading. Its the apk straight out of the BuglessBeast ROM.
Click to expand...
Click to collapse
What is the sense messenger app called? I can't find anything resembling it.
Here's a list of my HTC programs.
Code:
# ls /system/app/*htc*
/system/app/com.htc.MusicWidget.apk
/system/app/com.htc.NewsReaderWidget.apk
/system/app/com.htc.TwitterWidget.apk
/system/app/com.htc.WeatherWidget.apk
/system/app/htcbookmarkwidget.apk
/system/app/htccalendarwidgets.apk
/system/app/htccontactwidgets.apk
/system/app/htcmailwidgets.apk
/system/app/htcmsgwidgets.apk
/system/app/htcsearchwidgets.apk
/system/app/htcsettingwidgets.apk
I see the htc messenger widget but do I have to get rid of that? I don't think that's the messenger application file.
initial said:
What is the sense messenger app called? I can't find anything resembling it.
Here's a list of my HTC programs.
Code:
# ls /system/app/*htc*
/system/app/com.htc.MusicWidget.apk
/system/app/com.htc.NewsReaderWidget.apk
/system/app/com.htc.TwitterWidget.apk
/system/app/com.htc.WeatherWidget.apk
/system/app/htcbookmarkwidget.apk
/system/app/htccalendarwidgets.apk
/system/app/htccontactwidgets.apk
/system/app/htcmailwidgets.apk
/system/app/htcmsgwidgets.apk
/system/app/htcsearchwidgets.apk
/system/app/htcsettingwidgets.apk
I see the htc messenger widget but do I have to get rid of that? I don't think that's the messenger application file.
Click to expand...
Click to collapse
The Sense Messenger app is called Mms.apk. Delete the Mms.apk and Mms.odex files. It's in the OP
Do not delete htcmessengeruploader.
kpoz said:
The Sense Messenger app is called Mms.apk. Delete the Mms.apk and Mms.odex files. It's in the OP
Do not delete htcmessengeruploader.
Click to expand...
Click to collapse
Oh didn't realize it was the same. I'm using DamageControl's ROM and assumed HTC had a different label for some reason. Thanks for clearing that up.
In any case, I got a few FCs here and there and MMS is failing to send on the DC ROM. I'll tinker with it some more and see if I can figure something out.
btw, if anyone is doing this on DC's ROMs then don't bother looking for any *.odex files since his rom is de'odexed.
initial said:
Oh didn't realize it was the same. I'm using DamageControl's ROM and assumed HTC had a different label for some reason. Thanks for clearing that up.
In any case, I got a few FCs here and there and MMS is failing to send on the DC ROM. I'll tinker with it some more and see if I can figure something out.
btw, if anyone is doing this on DC's ROMs then don't bother looking for any *.odex files since his rom is de'odexed.
Click to expand...
Click to collapse
Originally, Kiraly and I tried pushing these files and then using a shell to install them, but it resulting in a ton of force closes. We couldn't open any of the apps.
Regrettably, I'm not savvy enough to attempt to fix this issue for you if you are running a ROM like DC, especially a deodexed ROM. Best of luck to you.
Maybe the install command will work for you where it failed for me.
Try the following:
Code:
adb shell
mount -o remount,rw -t yaffs2 /dev/block/mtdblock4 /system
exit
adb push :\Users\YourUserName\Browser.apk /sdcard
adb shell
install /sdcard/Browser.apk /system/app
exit
adb reboot

[GUIDE] A bugfix for WordsWithFriends using apktool

This guide is a great example of how to hack a third-party, closed-source application using apktool and smali. The first goal is to fix an annoying UI lag bug in Words With Friends by inserting a call to Thread.yield() at the top of a tight loop before acquiring a global lock. The second goal is to turn off the advertisements that display after every move.
Table of Contents
1. Install Words With Friends from Google Play
2. Extract the APK file from device onto PC
3. Decompile the APK file
4. Edit Smali: add Thread.sleep() to animation loop
5. Edit Smail: remove addActivity() call for ads
6. Reassemble the APK file
7. Sign the Reassembled APK File
8. Zipalign the reassembled APK file
9. Uninstall Words With Friends from the device
10. Install the fixed Words With Friends APK to the device
Appendix A: Troubleshooting
1. Install Words With Friends from Google Play
Words With Friends is a free application provided by Zynga and is available for install from the Google Play store. Simply search for Words With Friends and install it. More information about the app is available at http://www.wordswithfriends.com.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
2. Extract the APK file from device onto PC
In order to modify the Words With Friends application the APK file needs to be obtained. There are several different ways to extract an APK file from your device. The method outlined here is using Astro File Manager from the Google Play store.
Install Astro File Manager from the Google Play store
Launch Astro File Manager from home screen
Select "Application Backup" *
Checkmark "Words Free"
Click "Backup"
Copy the Words With Friends APK file from /sdcard/backups/apps to your PC
* If the screen does not have an "Application Backup" item but rather goes straight into the file browser, open the menu and select "Application Backup" from the there instead.
Astro File Manager will create the folder "backups/apps" on the SDCard if it does not exist and put the Words With Friends APK file in it. The file name may vary, and in my case it was "Words Free-4811.apk".
If you have root access to your device, it may be easier to simply copy the APK file from /data/app to /sdcard and then copy it off the device from the SDCard. To do this I like to use a program called "Terminal Emulator", which can be installed from the Google Play store. Then you can just run the "su" command followed by "cp /data/app/com.zynga.words-1.apk /sdcard" to copy the APK file to the SDCard.
3. Decompile the APK file
The next step is to decompile the Words With Friends APK file using "apktool". The apktool application is freely downloadable from http://code.google.com/p/android-apktool and requires the Android SDK and Java Development Kit (JDK) to be installed. The steps that follow assume that the directory with the "apktool" command is in the PATH environment variable and may be called without having to give the absolute path. I will not cover the steps to install the Android SDK nor apktool here, as there are numerous good instructions on the Internet. The apktool application works on Windows, Mac, and Linux. I will be using Ubuntu Linux 12.04 64-bit (not that it really matters!).
Open a terminal/command prompt into the directory where the Words With Friends APK file is located. In my case, the name of the APK file was "Words Free-4811.apk", but I have renamed it to "WordsWithFriends-original.apk" for simplicity.
Run the following command to decompile the APK. The "-d" command-line argument decompiles the application in "Debug mode". I am not entirely sure what this does, but many instructions recommend its usage. Since it has worked for me, I use it unconditionally. If you get any errors with this commoand, try removing "-d" to see if that works.
apktool decode -d WordsWithFriends-original.apk decoded​
This command will create a directory named "decoded" with the decompiled contents of the APK.
4. Edit Smali: add Thread.sleep() to animation loop
One of the bugs in Words With Friends is that there is a tight loop that spins, acquiring the graphics lock, checking if there are any animations to draw, then performing the animations if there are any. The problem is that sometimes this thread "thrashes" or "spins", causing the UI of the application to become temporarily unresponsive. This bug is especially noticable when a blank tile is played: after selecting the letter for the tile, the app appears to hang for several seconds. The fix for this is simple: put a call to Thread.yield() at the top of the loop before acquiring the graphics lock.
To fix this, open the file decompiled/smali/com/zynga/words/ui/game/as.smali in a text editor. Find the "run" method and then the line that follows that looks like:
iget-object v0, p0, Lcom/zynga/words/ui/game/as;->c:Landroid/view/SurfaceHolder;​(for me this was at line 136). The two lines above it should be ":try_start_0" and ".line 2569" ("2569" may be different). Insert the following line *above* the ".line 2569" line:
invoke-static {}, Ljava/lang/Thread;->yield()V​
Save the changes to the file then exit.
5. Edit Smail: remove addActivity() call for ads
Do you ever get annoyed at the advertisements that are displayed after each move you make? Although this may not be legal, it is quite simple to stop those ads from displaying. All you need to do is remove the command that displays them.
To do this, open the file decompiled/smali/com/zynga/toybox/ads/f.smali in a text editor. Find the line with the text "startActivity" (for me this was line 181) and either delete it or add a '#' as the first character of the line (to turn it into a comment). Then, comment or delete the ".line" line immediately above the startActivity line. Save the changes to the file then exit.
6. Reassemble the APK file
Now we need to rebuild the APK file from the modified smali sources. To do this, run the following apktool command:
apktool build -d decompiled WordsWithFriends-unsigned.apk​
This should create the APK file WordsWithFriends-unsigned.apk in the current directory.
7. Sign the Reassembled APK File
Before the modified APK file can be loaded onto a device it must be signed. The instructions below are adapted from the official "Signing Your Applications" page at http://developer.android.com/tools/publishing/app-signing.html.
If you are already setup for APK signing, then this paragraph may be ignored. Otherwise, run the following command to create a code signing key:
keytool -genkey -keystore keystore -alias MyReleaseKey -keypass password -storepass password -keyalg RSA -keysize 2048 -validity 10000​This will create a file named "keystore" in the current directory, protected by the password "password". Obviously, this is a terribly insecure password, so I wouldn't recommend using this key for anything else (unless you choose a better key). If you use different values for the -keystore, -alias, -keypass, or -storepass be sure to make the corresponding adjustments to the instructions that follow.
Run the following command to sign your APK file:
jarsigner -keystore keystore -storepass password -keypass password -sigalg MD5withRSA -digestalg SHA1 -signedjar WordsWithFriends-signed.apk WordsWithFriends-unsigned.apk MyReleaseKey​
Of course, replace the values of the -keystore, -storepass, -keypass, and MyReleaseKey with the corresponding values on your system.
This should create a file named WordsWithFriends-signed.apk in the current directory, which is the signed version of the modified application.
8. Zipalign the reassembled APK file
Although it is not strictly required, as a performance increase the signed APK file can be "zipaligned". Simply run the following command:
zipalign 4 WordsWithFriends-signed.apk WordsWithFriends.apk​
This will create a file named "WordsWithFriends.apk" in the current directory which is both signed and zipaligned. This is the "final" APK file that is ready to be installed.
9. Uninstall Words With Friends from the device
Since the modified APK file is signed with a different key than the one used to sign the APK that was installed from Google Play, the Android OS will refuse to load the modified APK. So before loading it Words With Friends must be uninstalled from the device. This can either be done from the device (eg. from the home screen or Settings -> Applications screen) or by connecting the device to the computer via the USB cable and running the following command:
adb uninstall com.zynga.words​
10. Install the fixed Words With Friends APK to the device
Finally, install the signed and (optionally) zipaligned APK to the device connecting the device to the PC via the USB cable and running the following command:
adb install WordsWithFriends.apk​
And you're done! Enjoy a better Words With Friends experience.
Appendix A: Troubleshooting
If you encounter any problems, check this section before reporting it.
A1. Cannot sign into Words With Friends using Facebook
It seems that sometimes after replacing the Words With Friends application from Google Play with the custom one that Facebook authentication does not work. Specifically, when the Words With Friends application starts up and prompts for either a Facebook account or email address to sign in, when Facebook is selected it briefly starts loading the Facebook page then returns to the Words With Friends application without having logged in.
This may be because the signature on the APK has changed. The workaround is to uninstall the Facebook application, log into Words With Friends with Facebook, then re-install the Facebook application from Google Play. This will cause Words With Friends to use the facebook.com web page to log in instead of the Facebook application that is installed locally, which does not check APK signatures.
A2. Words With Friends no longer updates from Google Play
Yep, that's unavoidable. To upgrade you will need to go through this entire process again, first uninstalling the modified Words With Friends and starting over with installing from Google Play.
A3. adb install fails with error "INSTALL_PARSE_FAILED_NO_CERTIFICATES"
If "adb install" fails with the error "INSTALL_PARSE_FAILED_NO_CERTIFICATES" then be sure that you are attempting to install the signed APK, as the OS will refuse to load unsigned APKs.
If you are using JDK 7 (as opposed to JDK 6 or 5), which can be tested by running "javac -version" then make sure to include "-sigalg MD5withRSA -digestalg SHA1" in the command-line arguments to jarsigner. The default signing algorithm changed in JDK 7, requiring that these arguments be explicitly specified (see http://developer.android.com/tools/publishing/app-signing.html#signapp for details)

[DIY-TUT/HOW-TO] Debloat and Save Battery

Note: This is not a ready made script that will do things for you. If you are looking for a script/tool to debloat your phone head here. This is a very basic guide, many of you might be aware how to do it already. This is for the absolute newbies like me who like learn by doing it themselves. So lets start!
First, What is Debloat? What are the benefits?
Ans: A new device (except the nexus family) always comes pre-loaded with a lot of manufacturer apps. Most of the times these apps are utterly useless to the end-user considering that there are better alternatives available on the play store. Such apps constitute the phone bloatware. Often these apps are part of the system partition on your phone ie they are system apps and cannot be uninstalled or removed like normal apps. The process of removing these apps is called as debloating!. Savvy?
Fine, Moving ahead. Whats more problematic about these apps is that many of these apps load at system start-up and keep running in the background using precious cpu and other resources apart from eating up memory. This often leads to poor performance and battery life. So once you get rid of these apps you will start experiencing better performance AND AN AWESOME BATTERY LIFE(personal experience)
Wow, I want to get rid of those stubborn apps...show me how to do it.
Sure
PRE-REQUISITES:
1. You should be rooted
2. Your phone should have the ClockWorkMod (CWM) Recovery installed.
3. You should have adb up and running
4. Turn on usb debugging.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
OPTIONAL:
1. You may want to create a Nandroid Backup through CWM before doing any of the steps listed below.
2. Install abdb insecure by chainfire to run adb commands as root(insecure boot image). This will allow you to boot in to recovery through adb. Once installed the app should look like this
The PROCESS:
1. Ensure that the pre-requisites are met.
2. Connect the phone to the computer through the USB cable
3. To check whether you have properly installed adb do this
Open a command prompt window (start>run>cmd) and type this
Code:
adb devices
If adb is set up and running it should list your device in the list of attached devices some thing like this
Code:
List of devices attached
42801c7449ff097 device
4. Now use the following command to make a backup copy of all the system apps on your phone
Code:
adb pull /system/apps C:\* destination of your choice *
This will ensure that you can install back any app that you remove using this process and also it serves as a reference to the list of system apps. Look at the apps and make a list of apps that you want to get rid off. This (thanx to winwiz for compiling it)might help you to decide which one's are important and which are not, which one's can safely be gotten rid of and which should not be touched. Play carefully. Here is a list of apps that I have safely removed with great benefits to boot-up time, battery and overall performance.
Dlna.apk
Dlna.odex
BuddiesNow.apk
BuddiesNow.odex
Days.apk
Days.odex
Email.apk
Email.odex
EmailWidget.apk
EmailWidget.odex
GameHub.apk
KiesAir.apk
kieswifi.apk
kieswifi.odex
Kobo.apk
MusicHub_N1.apk
MusicHub_U1.apk
PressReader.apk
ReadersHub.apk
ReadersHub.odex
SamsungApps.apk
SamsungAppsUNA3.apk
SamsungIM.apk
SamsungWidget_News.apk
SamsungWidget_News.odex
SamsungWidget_StockClock.apk
SamsungWidget_StockClock.odex
SevenEngine.apk
SnsAccountFb.apk
SnsAccountFb.odex
SnsAccountLi.odex
SnsAccountTw.odex
SnsAccountLi.apk
SnsAccountTw.apk
SnsDisclaimer.apk
SnsDisclaimer.odex
SnsImageCache.apk
SnsImageCache.odex
SnsProvider.apk
SnsProvider.odex
SocialHub.apk
SocialHub.odex
Zinio.apk
Click to expand...
Click to collapse
You may want to add/remove apps to/from this list.
5. Moving on, Once you have decided the apps to remove reboot into CWM recovery. Use this command to do that through adb.
Code:
adb reboot recovery
Note: You must have an insecure boot image for this to work (See point number 2 in optional points)
else
use any of the common methods to boot into recovery. Use key presses or CWM Manager or do whatever, just get in to that ******g recovery.
6. Next, Once you are into the recovery type this command in the command prompt
Code:
adb shell
This will get you into the linux shell on your android device so that you can use all the linux shell commands like in a regular linux shell
7. You must now see a # or $ at the prompt (doesn't make a difference) indicating that now you are into the linux shell. Type the following command in the prompt.
Code:
mount /system
This will load the system partition into memory so that you can play around with its contents.
8. Now to the most important step. Removing the apps. Use the following command in the prompt
Code:
rm /system/app/****.apk
or
Code:
rm /system/app/****.odex
Replace **** with the name of the apk or odex file that you want to remove.
Repeat the command for all the files that you want to get rid off.
Note: Remember to press enter after each command
9. Once you have finished removing all the bloatware just type
Code:
exit
in the prompt. Thats it.
Reboot! (You may use
Code:
adb reboot
for that purpose).
You will now be greeted with a faster performing, responsive, battery conserving and most importantly a bloatware free phone.:good:
10. Thank me if this helped and don't hesitate to ask questions.
As a supplementary note I would like to recommend this app [Requires Root]. Once installed use its corpse finder feature to eliminate all the left over files belonging to the bloatware apps that we just removed. It is as easy as Search and Clean. This will free up more space in your system partition.
Troubleshooting:
Q. I removed Kies Air using the method above but it is still present in the app drawer. What to do?
Ans: This happens if you have updated Kies Air through the play store.
Go to Settings>Applications>Manage Applications
Scroll down to Kies Air --> Select it ---> Uninstall updates
Reboot!. Thats it. Kies Air is gone for good.
A Very Important Note:
I haven't tried it on a Non-Rooted phone. But I think it should work as far as you have adb working and can boot into the recovery(Stock recovery in case of Non- Rooted phones) by some means you are good to go from step number 6.. Have a list of apps to be removed before hand, speeds up the process.
Battery Saving Tips:
Coming Soon.....!
RESERVED!!
Buddy we are already having automated tool for removing bloats ...
mj.vikram said:
Buddy we are already having automated tool for removing bloats ...
Click to expand...
Click to collapse
I'm aware of that buddy. I have even mentioned it in my post.:good: As I said this method is for people who would like to understand whats happening behind the scenes...rather than just flashing a script package.
The-Droidster said:
I'm aware of that buddy. I have even mentioned it in my post.:good: As I said this method is for people who would like to understand whats happening behind the scenes...rather than just flashing a script package.
Click to expand...
Click to collapse
Thanks for taking time and writing this :good:....
Nice guide and just one more alternative for user's if you feel this is difficult process for you, using Root explorer or similar app's got to /system/apps/ and delete the required file's (as mentioned by The-Droidster in the above) and restart the mobile...
What if I just go to my system folder through a root explorer and delete these files in /system/app and then reboot my phone? And then use that corpse finder?
ICS = I SEE ASS Lol
++##» GALAXY R «##++
gitanshu said:
What if I just go to my system folder through a root explorer and delete these files in /system/app and then reboot my phone? And then use that corpse finder?
Click to expand...
Click to collapse
its same buddy, both are same but this for the people who want to learn how to use ADB they can use this because this very well explained :good: ....
gitanshu said:
What if I just go to my system folder through a root explorer and delete these files in /system/app and then reboot my phone? And then use that corpse finder?
ICS = I SEE ASS Lol
++##» GALAXY R «##++
Click to expand...
Click to collapse
I don't see any problem in doing that....but you may experience force closes if you do this when the system is online because the apps that you are removing are still running in the background. So it is better if you do it by mounting the system through recovery.
if uu have rooted phone than u can remove bloat using titanium backup or rom toolbox pro
+1 for using Adbd insecure. It's a great debugging tool on stock roms.
Sent from my GT-I9103
Adam77Root said:
+1 for using Adbd insecure. It's a great debugging tool on stock roms.
Sent from my GT-I9103
Click to expand...
Click to collapse
Yeah its like unleashing a new side of adb. Makes it all the more valuable

[GUIDE] How to extract, create or edit android adb backups

What is an android adb backup?
An adb backup is a file with ab extension, generated by android's backup manager when we request it via adb shell. This allows you to backup some data of the phone, but is not a replacement of a clockworkmod backup:
- Java 7 or higher is required because of SYNC_FLUSH mode for the Deflater.
- If the backup contains apk+data for an app, restore will work. If contains only the data, you must install the app first on the device and then restore. Installing the app later won't work.
- Some apps include a policy where the apk is never backed up even if specified.
- Inside an ab file is a tar file, which contains files and folders in a certain order. You have you respect that order, which is not necessarily alphabetical like tar does by default. Such order is listed in "Full local backup infrastructure".
- Inside the tar file, directories must not have trailing slash, for that reason pax, star or equivalent has to be used.
- There are some bugs present in the android source code.
- 'adb backup' or 'adb restore' are pretty slow, between 1 and 2.6 MBps.
- The adb backups (usually with .ab extension) can be password protected or not. If the device is encrypted this is a must and has to be the same used for the device.
- Star is recommended instead of pax, which supports path length only up to 100 characters, so will fail in some cases. This usually happens with browsers history.
- ADB backups are not a replacement for a Nandroid backup. The whole /data partition is not backed up, only a part of it. Also, other partitions like /system, /preload, /cache, modem, RIL, efs, kernel or recovery are never backed up because are not user data. This is to prevent issue when restoring on a different device. It has also the biggest
- If you have the device encrypted with a password, you must use that particular one for backup creation and restore. You can't create a backup without password or a different one in that particular case, or if you try to restore will fail.
- star for cygwin for windows is attached (move it to C:\cygwin\bin\star.exe) since there is no package available. It can be compiled from the schily (ftp://ftp.berlios.de/pub/schily/).
- The best way to test if an adb backup has errors, is to convert it to tar and then check.advantage that doesn't require root to operate, so is totally compatible with stock roms, locked bootloaders and device encryption.
- There's also a bash script called adb-split.sh that creates individual adb backups for each recognized app from the full one, so you can restore apps individually. Same encryption is preserved to them, if any.
You can use java or perl, although with perl can be more complicated because requires downloading some modules from cpan and some ssl headers.
To know more information about types of android backups:
[Guide] Types of Android backups
Software needed
The entire process can be done from Windows, but is better to use a unix-like operating system, like Linux, OS X or BSD, since we should extract the files on a filesystem that preservers file permissions and owners and repack the tar archive. Furthermore some tools like star are easier to get for linux. In such cases, using Virtualbox or VMWare Workstation is highly recommended. Using Windows should work in any case whatsoever.
Cygwin
Preferably 32 bits: has more packages and is less prone to errors. Furthermore, the star for cygwin attached is 32 bits.
Java 7 or higher
Java 7 or OpenJDK 7 (more builds here)
Oracle Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 7 if you are going to work with password encrypted backups.
You need to install the files local_policy.jar and US_export_policy.jar under jre's lib/security folder, for example:
- For Windows:
C:\Program Files\Java\jdk1.7.0_09\jre\lib\security\
C:\Program Files\Java\jre7\lib\security\
C:\Program Files (x86)\Java\jdk1.7.0_07\jre\lib\security\
C:\Program Files (x86)\Java\jre7\lib\security\
- For Linux or BSD:
/usr/local/jdk1.7/jre/lib/security/
/usr/lib/jvm/java-7-openjdk-*/jre/lib/security/
/usr/local/openjdk7/jre/lib/security/
- For OS X:
/Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home/jre/lib/security/
Perl
Perl is available for several operating systems
libssl or openssl headers. If you are using Linux or Cygwin is much more easier
cpan modules required by use functions
pax or star
pax is an archiving utility that compresses in ustar by default. In this case is extremely useful because stores directories without trailing slash. Is available for all operating systems, and in windows can be installed via cygwin's setup.exe or download a native version like gnuwin32 (sometimes available via bsdtar with pax option). pax doesn't work when paths are more than 100 characters lenght, so I recommend star instead.
star allows storing directories without trailing slash. You can get the ubuntu version 1.5 here. For Windows you can use Cygwin's version included.
Android Backup Extractor
Android Backup Extractor is the java application that does all the job. It includes the perl scripts.
How it works, better with an example
I will use an example to demonstrate how it works, with java version. If you like to use perl, just grab the perl scripts and is nearly the same.
This is extracted from the readme file, and will extract a whole adb backup and repack only the data for the game Grand Theft Auto III for android.
1) Convert the original adb backup to tar format:
Code:
java -jar abe.jar unpack nexus7.ab nexus7.tar <password>
2) Extract the contents of the tar archive. This should be done on a filesystem where the permissions of the files inside the tar are preserved, for example using linux, mac or bsd. Up to two folders may appear, apps and shared:
Code:
tar -xvf nexus7.tar
3) Make a list of all the contents of the original archive in the order they are archived:
Code:
tar -tf nexus7.tar > nexus7.list
4) Create a new list only with the files and folders you want, in proper order. For example for the GTA 3 (you can try savegames instead of all data):
Code:
cat nexus7.list | grep com.rockstar.gta3 > gta3.list
5) Create the new tar archive. The directories stored on tar shouldn't contain trailing slashes, so I use pax or star instead of tar. Pax works also if paths are up to 100 of lenght:
Code:
cat gta.list | pax -wd > gta3.tar
OR
Code:
star -c -v -f gta3.tar -no-dirslash list=gta3.list
6) Create the adb backup from the tar archive. Password is optional:
Code:
java -jar abe.jar pack gta3.tar gta3.ab <password>
Note: if the backup is not encrypted zlib can be used instead for both unpack and pack the ab archive:
- Quick unpacking:
Code:
dd if=nexus7.ab bs=24 skip=1 | openssl zlib -d > nexus7.tar
- Quick packing:
Code:
dd if=nexus7.ab bs=24 count=1 of=gta3.ab ; openssl zlib -in gta3.tar >> gta3.ab
Split an Android backup
Use Android Backup Splitter (is a shell script). Works on Cygwin too:
sh adb-split.sh backup.ab [password if needed]
Resulting files go in app-ab folder
# ADB Backup Splitter:
#
# This bash script utility generates an adb backup for each item
# on apps/ folder. That equals to generating an adb backup for
# each app.
#
# shared/0 and shared/1 (sdcards) are ignored, so that means that
# external data and OBB files, although may be backed up, may not
# be restored. For doing so backup the folder Android of the sdcards.
# Creating a backup with -shared flag has know issues (corruption)
# so is not recommended. Future releases of this script may add
# the option to automatically detect things from sdcards inside
# the adb backup file.
#
# This script works on Cygwin also, and in general where star does.
#
# There may be apps in the backup that don't include the apk. In that
# particular case, the data won't be restored, so the individual backup
# is generated for testing purposes only. Installing the apk afterwards won't work.
# There is generated an html file called apk-missing.html so you can open it and
# install all applications from Play Store on any of your devices.
Patch apps to allow adb backup
Some apps specify in the AndroidManifest.xml android:allowBackup="false" so it won't be backed up by adb backup. If you have root and use Titanium Backup or CWM or TWRP they will do the job, but if you don't want root the only solution is to modify the apk to edit that string. Read here how to do that and the pros and cons:
[GUIDE] How to enable adb backup for any app changing android:allowBackup
Links
Android Backup Splitter (@ Sourceforge)
Android Backup Extractor (@ Sourceforge)
Android Backup Extractor (@ GitHub)
Documentation at Blogspot
Full local backup infrastructure
[Guide] Types of Android backups
Backing Up Android Games
Titanium Backup Decrypter
Perl scripts to encrypt/decrypt adb backup files
[GUIDE] Full Phone Backup without Unlock or Root
[GUIDE] Internal Memory Data Recovery - Yes We Can!
[Q] [adb] backup not working for Temple Run
Related adb backup and restore bugs:
Issue 55860: adb backup skips the apk for certain apps and doesn't prompt for download when restoring
Issue 48126: device adb connecting to localhost adbd cannot execute commands anymore since 4.2.2 (error device offline)
Issue 3254: adb shell doesn't return exit code of program
Issue 53065: Debugging via ADB stopping the onClick action on ImageView widget
Issue 53668: ADB : An existing connection was forcibly closed by the remote host
Issue 54781: adb install: single quotes in filenames cause quoting issues
Issue 55173: (Game) Offroad Legends does not detect obb when restored via adb restore
Issue 55178: (Game) Carmageddon Promo does not detect obb when restored via adb restore
Issue 28303: adb backup doesn't respect -noshared flag
Issue 32830: adb restore errors not displayed on device
Issue 34311: Galaxy Nexus gets stuck when restoring adb backup
Issue 25780: BackupManager causes reboot when BackupAgent missing
Issue 40691: ab backup and restore Ski Safari does not restore saved data
Issue 16286: Restoration of phone not working properly
Issue 39014: Nexus 7 adb restore freezes when restoring udk.android.reader
Warning about Helium (Carbon): helium backups are just android adb backups that are not compressed with Java Deflater. It means they were created with the option static final boolean COMPRESS_FULL_BACKUPS = false.
A normal adb restore should work.
Great guide, and can confirm that it does work!
I managed to use this method to restore my angry birds data from a Froyo phone (HTC Desire), to a Jelly Bean phone (HTC One X+). This is no easy task since you cannot use adb backup/restore on Froyo, but you can use adb pull, and you can't use adb push on Jelly Bean, but you can use adb backup/restore. Just in case anyone is looking to do the same, here is the process I used (requires having adb up and running but does not require root)...
As the adb backup function doesn't work on Froyo, I had to use adb pull to grab the angry birds data files (highscores.lua and settings.lua). Then, making sure that you have angry birds installed on the jelly bean phone and have played the first level, use the adb backup command to backup just the angry birds app. You can then use scandiuns guide to extract a tar file from the backup file, and then extract the "app" folder from the tar file.
Once this is done, you will find the highscores.lua and settings.lua files in the apps/com.rovio.angrybirds/f directory. Replace these two files with your original ones that you pulled from the old device. Then package up the app folder using the guide. Then just use adb restore to restore the modified backup file to your new device, and you should have all your old scores restored!
Hope that helps and thanks to scandiun for the great guide! :good:
cn198 said:
Great guide, and can confirm that it does work!
I managed to use this method to restore my angry birds data from a Froyo phone (HTC Desire), to a Jelly Bean phone (HTC One X+). This is no easy task since you cannot use adb backup/restore on Froyo, but you can use adb pull, and you can't use adb push on Jelly Bean, but you can use adb backup/restore. Just in case anyone is looking to do the same, here is the process I used (requires having adb up and running but does not require root)...
As the adb backup function doesn't work on Froyo, I had to use adb pull to grab the angry birds data files (highscores.lua and settings.lua). Then, making sure that you have angry birds installed on the jelly bean phone and have played the first level, use the adb backup command to backup just the angry birds app. You can then use scandiuns guide to extract a tar file from the backup file, and then extract the "app" folder from the tar file.
Once this is done, you will find the highscores.lua and settings.lua files in the apps/com.rovio.angrybirds/f directory. Replace these two files with your original ones that you pulled from the old device. Then package up the app folder using the guide. Then just use adb restore to restore the modified backup file to your new device, and you should have all your old scores restored!
Hope that helps and thanks to scandiun for the great guide! :good:
Click to expand...
Click to collapse
I have tried similar attempt to restore my save of another game but that doesn't work.
How did you replace the files in the .tar file? I am using 7z to replace the .tar file but nothing happen after i restored.
Thanks.
ball3t said:
I have tried similar attempt to restore my save of another game but that doesn't work.
How did you replace the files in the .tar file? I am using 7z to replace the .tar file but nothing happen after i restored.
Thanks.
Click to expand...
Click to collapse
Read the guide. 7z is not compatible, you have to use star or equivalent and meet the requirements.
scandiun said:
Read the guide. 7z is not compatible, you have to use star or equivalent and meet the requirements.
Click to expand...
Click to collapse
star
star is required since GNU Tar does not allow storing directories without trailing slash. You can get the ubuntu version 1.5 here. For windows or Cygwin I haven't found it yet, if exists.
Because i am using windows, so does it mean that i couldn't modify the .tar file in any way?
thanks.
ball3t said:
Because i am using windows, so does it mean that i couldn't modify the .tar file in any way?
thanks.
Click to expand...
Click to collapse
Yes, from windows you can use pax. You can download it from cygwin's setup.exe. I've updated the guide, see the step 5.
scandiun said:
Yes, from windows you can use pax. You can download it from cygwin's setup.exe. I've updated the guide, see the step 5.
Click to expand...
Click to collapse
it worked!!
thank you so much.
Maybe I'm missing something.
I've installed Java, ran cygwins setup.exe and I think it installed everything. Also downloaded the Android Backup Extractor. I try running a windows command prompt with:
java -jar abe.jar unpack nexus7.ab nexus7.tar
All I get is "java is not an internal or external command". I'm running the command prompt in the android backup extractor folder. Does everything have to be in the same folder? Where do I dump everything?
AAhrens said:
Maybe I'm missing something.
I've installed Java, ran cygwins setup.exe and I think it installed everything. Also downloaded the Android Backup Extractor. I try running a windows command prompt with:
java -jar abe.jar unpack nexus7.ab nexus7.tar
All I get is "java is not an internal or external command". I'm running the command prompt in the android backup extractor folder. Does everything have to be in the same folder? Where do I dump everything?
Click to expand...
Click to collapse
Probably java is not in your path, try
Code:
which java
It should result something like
Code:
$ which java
/cygdrive/c/Windows/system32/java
Add Java to the Windows Path
Then restart cygwin
Omg omg omg! Thanks for the guide you just saved my ass, i love you!!!!!
scandiun said:
2) Extract the contents of the tar archive. This should be done on a filesystem where the permissions of the files inside the tar are preserved, for example using linux, mac or bsd. Up to two folders may appear, apps and shared:
Code:
tar -xvf nexus7.tar
Click to expand...
Click to collapse
Hi,
I'd like to try this out on a Windows 7 (virtual) machine. All software installed an clear what to do. But how do I manage to preserve the file permissions? Does Cygwin take care of that?
Thanks
ttv said:
Hi,
I'd like to try this out on a Windows 7 (virtual) machine. All software installed an clear what to do. But how do I manage to preserve the file permissions? Does Cygwin take care of that?
Thanks
Click to expand...
Click to collapse
You can't preserve the exact permissions because of the operating system and the filesystem. While permissions will be somewhat similar the owner will change completely. While android has the owner encoded by a number windows will use your windows username. I made simple modifications of backups on windows and luckily worked, but of course can't promise you that will apply for all the cases.
If you know how to use virtual machines, why just don't use linux / unix? For example if you use PC-BSD or Linux Mint you can download directly the Virtualbox image and then share a folder or use ftp server.
http://virtualboximages.com/LinuxMint+14+KDE+Desktop+32bit+Virtual+Appliance
scandiun said:
If you know how to use virtual machines, why just don't use linux / unix? For example if you use PC-BSD or Linux Mint you can download directly the Virtualbox image and then share a folder or use ftp server.
http://virtualboximages.com/LinuxMint+14+KDE+Desktop+32bit+Virtual+Appliance
Click to expand...
Click to collapse
Thanks for the answer.
I didn't understand the bit about sharing a folder on Unix before, but now I think it clicks.... The Linux/Unix VM is only used to share a folder in which I can extract the Android backup from my Windows machine right? So that way I can still use the installed software and drivers for my Nexus 4 on the Windows machine. Do I understand this correctly?
If that's the case I am going to try right away. Otherwise I have to make the Nexus 4 software installation work on the Unix/Linux VM and that will take a lot more time I think.....
ttv said:
Thanks for the answer.
I didn't understand the bit about sharing a folder on Unix before, but now I think it clicks.... The Linux/Unix VM is only used to share a folder in which I can extract the Android backup from my Windows machine right? So that way I can still use the installed software and drivers for my Nexus 4 on the Windows machine. Do I understand this correctly?
If that's the case I am going to try right away. Otherwise I have to make the Nexus 4 software installation work on the Unix/Linux VM and that will take a lot more time I think.....
Click to expand...
Click to collapse
Yes, I mean to access from linux the folder you share in windows, but then remember to copy the backup inside linux to extract it there, to preserve permissions.
You have the option to share folders in Virtualbox and VMWare Workstation. In case you use virtualbox, make sure the guest has Guest Additions installed. Some virtualbox images already come with it.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Well I got the java command to work, but now the "cat" command will not work? Your link to add java to the path worked for the latter, but how do I get 'cat' to work?
AAhrens said:
Well I got the java command to work, but now the "cat" command will not work? Your link to add java to the path worked for the latter, but how do I get 'cat' to work?
Click to expand...
Click to collapse
What exact error are you getting?
scandiun said:
What exact error are you getting?
Click to expand...
Click to collapse
"Cat is not an internal or external command"
AAhrens said:
"Cat is not an internal or external command"
Click to expand...
Click to collapse
What shell are you using? cat is included on any default linux installation.
scandiun said:
What shell are you using? cat is included on any default linux installation.
Click to expand...
Click to collapse
Windows 8
On Cygwin you have cat and the other utilities you have to install them from the setup.

Categories

Resources