8

I would like to take an installed app, including its data, from a rooted Android device and produce from it an APK suitable for installing on a non-rooted Android device.

Is this possible?

Edit: Existing answers/comments seem to reinforce the idea that existing apps do not support embedding an app's data within an APK. Perhaps the more fundamental question is,can an APK embed files destined for /data/data/[appname], or are they restricted to being self-contained when installed?

Notes:

  • I assumed that, if it were possible, this functionality would be built into an app such as Titanium Backup. Titanium Backup can back up app+data to a single file, but that file is not an APK and can only be restored by Titanium Backup itself - which is no help for me as the destination device is not rooted and so cannot run TB.
  • Solutions that require use of the terminal on the phone or ADB are fine.

Thanks.

3
  • If you look into TB's backup folder you will note it stores the .apk plain (so at least you can take that). I need to look into the data files; AFAIR this were simply stored properties, but I cannot remember the format used. However, restoring data on a non-rooted device is probably very hard to achieve for the same reason as backup is: no access to the data folders...
    – Izzy
    Commented Aug 23, 2012 at 9:06
  • @Izzy TB has two backup methods. Its normal one stores three files in the backup directory - a tar.gz containing the APK, a tar.gz containing the contents of /data/data/[app]/, and a .properties file containing what I assume is a hash of the files. The other option (under "Send this Backup" -> "easy import" writes a single .TiBkp file that I believe contains the normal three. Either way, as you said, root access is required to restore the data to /data/data/[app]/ on the target device.
    – Ian Renton
    Commented Aug 23, 2012 at 10:10
  • Yepp. The latter format is intended for easy transfer to e.g. another device (and thank me for mentioning this to the people from ES file explorer, that app now recognizes those files and offers to have them opened by TB, if installed). I was rather referring to the format of the (uncompressed) data packages (XML, SQLite, SQL...) to figure out how one could manipulate those -- and right in the middle remembered the target being non-rooted... Still, it could be an interesting idea for a "customized transfer" to another rooted target.
    – Izzy
    Commented Aug 23, 2012 at 10:59

3 Answers 3

3

Having now read more about the APK file format, I think I can now safely answer my own question with "it's impossible".

An APK file does not contain a data structure which is "unpacked" on install like the packages used by, for example, most Linux distributions. Instead, an APK is simply a self-contained, rebadged JAR file that contains the application's bytecode, manifest and certificate and nothing else.

The contents of /data/data/[appname] are presumably created by the application code when it is first run (or at some future point), and there is no way of embedding such data into an APK so that the system automatically moves it to the correct destination at install time.

1
  • It's not true that an APK only contains the bytecode, manifest, and certificate. It also contains any resources and assets used by the app, but they remain in the APK file when the app is installed: they're not copied to /data/data/ unless the app is programmed to do that itself.
    – Dan Hulme
    Commented Apr 26, 2014 at 9:44
1

You can still get the APK of an app with applications like ES File Explorer, AppMonster or Titanium Backup. But I don't know if they back up datas when the APK is built.

2
  • Non-root apps hardly can include data. AppMonster for sure does not -- and as for Titanium, the OP already stated it doesn't fit his needs. For ES I doubt it extracts data.
    – Izzy
    Commented Aug 23, 2012 at 9:03
  • I have just tried ES, and it doesn't appear to include data with its backup either. (Or at least, when the backed up APK is installed on my non-rooted target device, the data I expect is not there.) As far as I can tell, ES' backup does nothing more than copy an APK from /data/apps to /sdcard/backups.
    – Ian Renton
    Commented Aug 23, 2012 at 10:06
0

Go on the play store and download ML Manager to extract the Apk files into a folder of your choice. I do not know how to include the app data in this.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .