Android Eclipse DDMS - Can't pull file from rooted device - android

I am testing my app on a rooted Nexus S phone. I finally have access to the /data/data folder thanks to some awesome help from this answer.
Problem is when I try to use DDMS to "pull a file from the device" I get this error:
[2012-03-20 18:15:26] Failed to pull selection
[2012-03-20 18:15:26] (null)
Anyone know how to pull a copy of the database so I can look at it in a SQLite editor?

I found out that to pull the actual database file (my_database.db) you have to use chmod on that specific file in the adb shell. So you need to explicitly define the path to the database you want to access.
For example, if the database file were my_database.db and the application package was com.example.database, you would need to call the following:
1) In cmd type: adb shell
2) Type: su
3) Press "allow" on the rooted phone
4) In cmd type: chmod 777 /data/data/com.example.database/databases/my_database.db
5) Go to DDMS in Eclipse
6) Navigate to the my_database.db file and select it
7) Choose "pull a file from the device" and choose where to save it

Restart your eclipse once. I hope that will fix this issue

Related

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/

Pull database from Genymotion emulator

I am using Windows7 and want to extract/pull the application database to the local windows machine's folder.
I have searched through internet and found the adb command as below :
adb shell su 0 cp /data/data/<package.name>/databases/<database.name> /mnt/shared/
I have tried the same by creating shared folder for the Virtual box.
But getting error is like : read-only file system
I have also check that read-only is disabled.
Please I need help.
Screenshots :
I'm not sure for Windows but on Mac you just call
adb pull /data/data/<package.name>/database/<database.name> <local.file.path>
As your phone under Genymotion is rooted, you can go in the DDMS of Eclipse.
Then, Click on the tab file explorer.
Then go to folder /data/data/<your.package.name>/ then pull the file from the path in which you saved your database.

Android Cannot see anything inside data folder

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.

Eclipse console shows:'Failed to push selection: Read-only file system'when i try to push a file

I am trying to push a file to the SD Card but its showing error in console 'failed to push selection: Read-only file system'.I am using DDMS perspective in Eclipse.I generated sdcard using mksdcard command.
Just go to
C:\Documents and Settings\<adminstrator>\.android\avd
take 'properties' of your avd folder (there is a folder for each of the avd's)
uncheck 'Read only' -> OK
This was the only thing that worked for me.
P.S: Some of these folders might be hidden.
On the Terminal or Command-Prompt, write these( for me its command prompt ):
adb shell(Opens the device shell. you'll see a #)
su(get the root permission, if necessary)
mount -o rw,remount rootfs /(remount the root file system.)
chmod 777 /mnt/sdcard (change the permission of the sdcard to rwe.)
exit
If it doesn't work, try to push the file from the same shell using adb push .
Hope this help.
You need to give SDCard support to your AVD and mount the SDCard.
First go to 'AVD Manager and select your AVD then Click on Edit and in the Hardware add SDCard Support'.
Please check this link for complete detailed step to achieve SDCard support and mounting.
You can also give a try to this command in CMD, this will remount your SDCard.
c:\android-sdk\platform-tools\>adb remount
I was also facing same issue :
Failed to push selection: Read-only file system
In computers with higher configuration(beyond Windows XP)
settings like ---> C:\Documents and Settings\.android\avd
doesn't exist so instead
go to this path --> C:\Users\.android and right click on this folder and uncheck the box having name as read only.
Hope this helps those with newer windows on their pc :) , if this solution helps you than please vote for it.
In my case i have mistake with the slash.
while specifying "Additional Emulator Command Line Options" in eclipse
Actually it should be -sdcard C:/Kamal/sdcard/emulator_sdcard
and i was putting -sdcard C:\Kamal\sdcard\emulator_sdcard
Then after restarting the Eclipse & Emulator it works.
If the data in the sd card is not updated in the emulator or in the app which you are developing then,
Select,
Dev Tools->Media Scanner
The data which has been already pushed into the sd card by variant means will get loaded soon.!
if some one have same problem in new build of studio . 0.8.9 and above see my solution here and it will work like a charm : (afra mehrparvar solution in the bottom of the page )
Android Emulator sdcard push error: Read-only file system

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