Extracting Files from Android Internal Storage for Debugging

Extracting Files from Android Internal Storage for Debugging

22 April 2024 Stephan Petzl Leave a comment Tech-Help

When developing mobile applications, it’s often necessary to inspect files directly from the device’s internal storage. For Android developers working with non-rooted devices, one of the challenges is to retrieve files such as databases for debugging purposes. This guide provides a straightforward method to extract files using the Android Debug Bridge (ADB) without requiring root access.

Using ADB to Retrieve Files

ADB is a versatile command-line tool that allows developers to communicate with an Android device. To access files restricted to your application’s internal storage, you can use ADB in conjunction with the run-as command, which allows you to execute commands as your application’s user ID.

Retrieving a Specific File

To download a file such as a database from an Android 5.1+ device, use the following command:

adb exec-out run-as com.example.package cat databases/mydatabase.db > mydatabase.db

This command streams the specified file from your application’s internal storage and saves it to your local machine.

Retrieving Multiple Files

If you need to download an entire directory, such as all files within the databases or shared_prefs directories, you can use the tar command:

adb exec-out run-as com.example.package tar c databases/ > databases.tar
adb exec-out run-as com.example.package tar c shared_prefs/ > shared_prefs.tar

This will create a tar archive of the directory, which can then be extracted on your local machine.

Integrating with Automated Testing

While manual retrieval of files is useful during development, integrating file extraction into automated tests can streamline the process. This is where Repeato, our no-code test automation tool, can be highly beneficial. Repeato simplifies the creation, execution, and maintenance of automated tests for iOS and Android apps.

Repeato’s ability to execute ADB commands through script steps makes it possible to incorporate file extraction directly into your test workflows. This can be particularly useful when you need to validate database changes or preferences following a test scenario. It supports various app frameworks, including React Native, Flutter, and Unity, ensuring compatibility with a wide range of projects.

By leveraging Repeato’s computer vision and AI capabilities, you can ensure that your tests are robust and maintainable, even as your app evolves. The tool’s fast edit and run cycle helps you to quickly adapt tests to changes in the app’s UI or functionality.


Retrieving files from an Android device’s internal storage doesn’t have to be a cumbersome process. With the right ADB commands and the integration of a powerful automation tool like Repeato, developers can efficiently manage and debug their applications. Whether you’re pulling a single file or an entire directory, these methods can save you time and provide deeper insights into your app’s behavior on an actual device.

Like this article? there’s more where that came from!