I am using android studio and 'samsung tab 2' as my testing device. I want to see the files of my application. So i clicked the 'Monitor' button. Then i selected my device from device list and selected my application package.There is a Data folder in file explorer. But when i clicked on the data folder it shows nothing.When i run this application using emulator the file explorer shows the data folder and i can see every files in my application. how can i see my files inside the data folder when using device ?
I found a solution based on the answer in stack overflow .
How to access data/data folder in Android device?
First i rooted the device .Then i modify the access permission of data folder using adb shell.
the code is
$ adb shell
$ su
# mount -o rw
1|root#android:/ # chmod -R 777 data/
Now i can access the files.Thank you #param for your valuable comment.
Related
I have a Xiaomi device, not rooted.
I have an app and I want to try to see where it saves its data, I think it's in \Android\data\com.zzzzz.zzz (app name).
When I go that folder from my Windows PC I can see there are 2 subfolders but each of them appears to be empty.
Is it possible that the the subfolders are not empty and that I see them empty because the phone is not rooted?
If I connect to the phone with adb shell, is there a way to see if the subfolders are actually empty?
Thank you very much.
This is the command to get files from device adb pull Android\data\data\com.zzzzz.zzz.
You can list all files in the folder by $ adb exec-out run-as com.yourcompany.app ls -R /data/data/com.yourcompany.app/
Or you can use android studio device file explorer from sidebar to see your files.
You can't see the files if the app is not debuggable
I has made a directory named abc via adb shell in /data/data/com.helloworld.new_munion_sdk_demo/files/ and com.helloworld.new_munion_sdk_demo is my app name.
I try to visit the files in abc in my app and I found no file can be read with a FileNotFoundException.
Because the dir made by shell is default belongs to user root, so I use chown and chmod 700 to change its permission as follow:
enter image description here
The dir abc is seems just no different like other normal directories, but its very odd this dir is can not be executable in the app, thus files in dir abc can not be readable.
enter image description here
This snapshot is from Android Studio.
I'm using nexus 5 and rom 6.0.1 complied by aosp.
If you want to use a directory to store files, you might want to look into this article on storage for android
Android Developers: Saving Files
Your app has access to this folder in Internal storage, which will be created using your own code.
The partition /data is reserved for the OS as far as I know.
I was attempting to access the data data folder of an application without rooting . I followed How to access data/data folder in Android device? and was able to access the folder.
Now I was trying to copy the required file from data/data to a folder in my SD Card , however I get a permission denied on it. In the thread I have referenced above , no body complained of this behaviour so I suppose it shouldn't happen at my end too .
This is exactly what I am doing
C:\AndroidSdk\platform-tools>adb shell
shell#D6503:/ $ run-as com.xxx.xxx
run-as com.xxx.xxx
shell#D6503:/data/data/com.xxx.xxx $ cp databases/xxx.db /storage/sdcard1/Pictures/
cp: /storage/sdcard1/Pictures/xxx.db: Permission denied
I have verified that the folder /storage/sdcard1/Pictures is accessible through shell.
Happened to me as well. This is what I did to access the contents of the data folder of my app in my Nexus 5 (Android 5.0), without having root access or chmoding any file:
Open a console where your ADB is located and execute:
adb backup -noapk com.your.packagename
You will be asked to accept the backup on your device. Accept it and don't use any password. Once the backup process is completed, you will have a file with .ab extension on your ADB folder.
The backup will be compressed in a special way, you can decompress it with this tool: Android Backup Extractor
To use it, unzip it and put the backup file (*.ab) on the same folder where the extractor (abe.jar) is. Then open a console there and execute the following command:
java -jar abe.jar unpack NAME_OF_BACKUP.ab NAME_OF_BACKUP.tar
Notice that the result of this operation will be a *.tar file, which can be opened or decompressed with WinRAR or many other compression tools.
OPTIONAL for SQLite Databases: If you want to see the contents of the database, you can use this Firefox plug-in: Firefox SQLite Manager
I am practicing to create a system app and testing using a rooted device. The application copies files(images,music and video) from a zip file to a the directory /data/media/0/SampleFolder. But after the files are copied, they are not recognized or can not be opened when viewed using ES File Explorer File Manager.
When I view via adb shell and enter the command ls -l /sdcard/SampleFolder/, the files are then recognized and they can be opened after entering said command. If not mistaken, the paths data/media and sdcard have symbolic links.
Does this mean that there is a sync problem between /data/media and /sdcard/ and if yes, is there a way to refresh it programmatically?
Note: The following have been tried but have not been successful:
Rebooting the device
entering ls -l command programmatically
called MediaScannerConnection.scanfile for each file in the /sdcard/SampleFolder directory
broadcasting Intent.ACTION_MEDIA_MOUNTED in Environment.getExternalStorageDirectory
broadcast Intent.ACTION_MEDIA_SCANNER_SCAN_FILE for each file in the /sdcard/SampleFolder directory
I pulled out a file from the android sdcard using adb and it seems it goes to c:\documents and settings\userName by default. I don't know how it got set to this folder since this is not where adb is installed, but probably has got something to do with the fact that both the workspace and .android folders are located here. How do I change this default location for pull command of adb?
The default directory for adb pull or adb push seems to be the current directory (aka . ).
If you issue a command such as the following, not specifying the target directory
adb pull /boot.txt
the file (provided it exists) will be copied to the current directory.
Windows users:
Take notice of the following: If you are using Windows (Vista or newer), chances are that if the current directory requires elevated privileges to write on, Windows will silently replicate the directory structure of your current directory in a special folder called VirtualStore and will copy your files in it.
The full path for VirtualStore is: %LOCALAPPDATA%\VirtualStore, which most likely will translate into C:\Users\<account_name>\AppData\Local\VirtualStore.
So, in the following scenario,
C:\> cd "C:\Program Files (x86)\MyCustomADBInstallLocation"
C:\Program Files (x86)\MyCustomADBInstallLocation> adb pull /boot.txt
your file boot.txt will end up in this folder
C:\Users\<account_name>\AppData\Local\VirtualStore\Program Files (x86)\MyCustomADBInstallLocation\
you can mention the destination location for adb push/pull, see example:-
adb push a.txt /data/local
adb pull /data/local/a.txt .
. means present directory.
or
adb pull /data/local/a.txt C:\
Hope this helps.
i'm using linux, and noticed that if i opened the terminal as root, its opened # home. when i pull items, it dumps to that repository, meaning to my "home" directory. will try opening terminal in a different folder and running adb pull from there to see if that makes the files dump to the folder terminal is opened in.