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.
Answer
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.
No comments:
Post a Comment