Android Cannot see anything inside data folder - android

i am trying to see SQLite database in anyway possible (I have a rooted device). I tried File explorer in eclipse but i cannot see anything under data folder. Can anybody please help me with this
I tried to search everywhere but couldnt find a clear solution.
I also tried adb shell but i cannot see list of things inside data folder using "ls" command.
error
Opendir failed. Permission denied
I am guessing this has something to do with rights but how can i fix it
Please help

You need root premission to explore DATA directory...
From phone
I use terminal emulator to do the job..... Simply open terminal then type in su after that it will ask for premision. then you need to type cd data/data/WhereEverYouNeedToGo/databases and "WhereEverYouNeedToGo" should be package name. After that you could do whatever you want with your database.
from PC
open terminal or cmd goto your adb directory then run adb shell then su and then
cd data/data/WhereEverYouNeedToGo/databases
Hope it helped.

Run adb in root mode using "adb root"

adb shell
su
ls /data/
Try this

You have been given a number of answers for how to leverage the root capability, however as android is designed without the assumption of root there are other methods as well which you can use while developing apps.
1) Include functionality on an expert menu to copy the database to the sdcard; there is no file copy method in android java (and in most stock cases no 'cp' shell command), but you can find numerous answers here with a copy routine.
2) Make your apk debuggable and use the run-as command to obtain a shell running as the application userid and starting in the app's data directory. You can then copy the database to the sdcard if the app has that permission.
3) Have your app set the permissions on the database file during development to world readable. Although you cannot browse the directory tree to down to it, you can then adb pull the database file by giving it's full path name.

You need to have either routed device or your device should be a "Android Dev Phone" to explore that directory. Trying checking the same using emulator, you will be able to see the data folder contents.

Related

How can I find my app and the SQLite .db file in Android

I created my first Android App with SQLite and tested it on my phone.
Now I installed an SQLiteManager on the phone and I would like to open the SQLitedatabse file.
The location is /data/user/0/com.<appname>/database/database.db
But this folder does not exist. How can I find and access the database file?
And I am also not able to find the apk of my App. In Android/data/ I can see all other installed apps, but not my own app.
How can I find yout where it is located?
The acutal path is /data/data/package.name/database.
If your app is in debug mode, most newer devices allow accessing this folder via Android Studio (or adb run-as). On the emulator this folder is public.
Just run the command in terminal
adb pull /data/data/com.example.myapplication/databases/your_db.db
No need to root your device.
I used this way on Mac with Terminal:
sudo adb -d shell "run-as com.YOUR_COMPANY.YOUR_APP_NAME cat databases/YOUR_DATABASE_NAME.db" > NEW_NAME_FOR_DATABASE.sqlite
Sometimes you need first to give that file a permission 666, so you can copy it to your computer.
chmod 666 YOUR_DATABASE_NAME.db
Your device must be Rootable for you to be able to see the .DB file
for the second question, try to search for your package name first. Maybe it's like xxx.xxx.Christina.xxx.AppName ?

Android Studio - Android Device Monitor's File explorer not working

I have just learnt using preferences in Android. For debugging purpose I need to access the preferences files. I googled and found the default location of the preference file and also how to access it via Android Device Monitor.
Somehow I am not able to open any folders under the File explorer tab of the Android device monitor. They just aren't responding. I tried waiting for ADM to load and tried again but no success. (Double click on folder is not working, STRANGE!)
Do we need to configure before using it? I am using Android studio.
Any help would be appreciated.
Attaching image
Finally I found how to make it work.
goto run -> location where your adb is
Ex: C:\Program Files (x86)\Android\android-sdk\platform-tools
type adb root , Enter (Your phone must have root)
If this doesn't work, install this app on your phone: [root] adbd Insecure or its free alternative here (update: link broken now).
Get more info at http://forum.xda-developers.com/showthread.php?t=1687590
You will need either to use the emulator or to have a rooted phone to use all functionalities.
Root your device and open adb shell and change the permissions as:
$ adb shell
$ su
1|root#android:/ # chmod -R 777 data/

How to retrieve files created by an android app?

My android app creates an sqlite database and I need to get it off the device so I can look at the data with a database viewer.
Was hoping I could just issue >adb shell and then go find it somewhere on the file system. Looks like there are permission issues with lots of commands. Even just running >find . -name *.sqlite gives permission denied.
Can anyone advise on how to do this?
It seems your device is not rooted, anyway..
Copy your .db file form /data/data/<package_name>/databases/ to ExternalStorage using code.. Then you can get it via adb pull command or DDMS -> FIle Explorer.
Currently there is no way to browse database on the device (without getting the root permission as you want) .
You can browse your database from emulator using adb shell.

Root Android phone

I have created a database for my app and I want to check .db folders to check the data inserted while developing. But my Android mobile will not allow to access data folder. To achieve this I have rooted my mobile with GingerBreak.apk. Device rebooted but nothing happened. How can I check my data base from my phone.
Note: I can't check the data using emulator, because app cant run on emulator, it uses, Bluetooth, WiFi,etc.
Regards,
Krishna
You need to install some file broswer(such as R.E file manager) to access to these .db files. They are located in /data/data/{package name} dir.
Meanwhile, you can access these file via command line.
For emulator:
Type adb shell in the command line, and you can see a "#" prompt.
Type 'cd /data/data/{package name}` to go to the very dir where the
.db file is located.
Now type sqlite3 <db file name, no extension> so that you can execute SQL command to read and control the .db file. Now you can see a "sqlite>" prompt.
For real device(phone must be rooted):
Step 2 and 3 are the same. In Step 1, you have to type "adb shell", and then "su" to see the "#" prompt.
Hope it helps.
To root your phone. You can use lucky patcher app.Although there are plenty of apps available around internet but i found it worth using
By using this app you can not only root your device as well as remove annoying ads and much more.

How to get root acess to data/app folder in Android eclipse emulator?

I'm new to Android development. I want to access "data/app folder in Android eclipse emulator to take backup of apk file that store in that directory but unfortunately I am unable to get access to that directory.
I have tried FACTORY_TEST to get root access permission but still no success.
you can do it by using adb command : e.g
E:\android-sdk-windows\platform-tools>adb pull /data/app/filename.apk e:\
If you don't have root access on the machine it's impossible. The phone need to be rooted in order to allow your app to do this kind of things.
First your phone should be rooted, you can use https://www.kingoapp.com/ for that.
Next, you should modify the permission of your app access, to do so you have to :
Locate your adb.exe folder (you can find it in your sdk folders)
Right click
open cmd here
Type:
adb shell
su
chmod 777 /data /data/data /data/data/yourapp
Good luck

Categories

Resources