Where are the application files in the Android Studio emulator

Asked

Viewed 1,622 times

0

I’m using the Android Studio emulator to test an application, so I’m using Sqlite to save some data, I want to know where the application files are and where Sqlite records, it would just be a matter of knowledge even.

EDIT:

I’m trying to access by adb and is giving permission denied, follows:

c: Android SDK Platform-tools>adb Devices List of Devices Attached Emulator-5554 device

c: Android SDK Platform-tools>adb -s Emulator-5554 shell generic_x86:/ $ chmod chmod: Need 2 Arguments

1|generic_x86:/ $ chmod 777 /date chmod: chmod '/data' to 40777: Permission denied

1|generic_x86:/ $ chmod 777 /date/date chmod: chmod '/data/data' to 40777: Permission denied

2 answers

0

Looks for the Side Menu "Device File Explorer", in my case it is in the Right corner; Then in the tree that opens go in : Data Data br.com.seuproject database seubanco.db

  • I used the "monitor.exe" and it can not open the folder "date" that is inside the com.'meuapp', I click to open but will not...

  • I know no other method

0


Android will save the Sqlite files in a directory called "Databases" inside the app package on the operating system.

To access this directory in an easy way, open Android Studio and find the option "Device File Explorer". In my Android Studio version 3.3.1 it is being displayed in the lower right corner of the IDE, if it does not appear in yours you can search for the option directly in the bar at the top that will find it.

After accessing the Device File Explorer, the list of connected devices will be shown inside a combobox (you can switch between the devices by selecting the desired one). Below is listed a lot of files and directories that are the files that Android has inside it.

Find in this list the directory data and open it. Another list will be shown with other directories, find again one with the name data (that’s right, are 2 data, one inside the other). When entering the second directory data search for your app package (to find its name open the Android Manifest from the app and right at the beginning of it find the package, the name there is what you need to find). The last step is to open the package directory of your app and access the folder databases, inside it is where is the bank file of your application.

Detail: The database file is created only when the app tries to access it. It is not enough to just open the application, the bank will only be created when it is actually requested access to it. If no call is made to the bank when the app is opened, it will not be created, at the time of any query or insertion or any action is that this happens.

Using the emulator it is even possible to extract this database easily using an "adb" CLI command. (If you have 2 or more connected devices you need to specify which one the command will be applied to. As soon as you keep only 1 emulator open and have no real device connected to the PC at this time so you can understand how the command works, later you can search the methods of directing the command even with more connected devices)

Syntax:

adb pull /data/data/<package da aplicacao>/databases/<nome do banco> <local de destino>

Example:

adb pull /data/data/com.exemple.app/databases/banco.db %USERPROFILE%\Desktop\
  • This "date" folder that gets inside the Android SDK is empty, this is what you are talking about?

  • I tried to "pull" by the Monitor and he hands me an empty folder too

  • @Igorboldt I edited the answer with more details to make it more understandable. The answer comprises the steps to find the file using Android Studio’s file explorer. The pull command is done following this path and I also described in the answer some tips for it to work properly. If not clear, you can still specify what you tried to do so that you can analyze and clarify some more details.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.