Android eclipse DDMS - Can't access data/data/ on phone
If you want to see all files you are storing inside your app folder, Run the adb with your app permissions, The you can see all your app folders.
adb shell
run-as com.your.package
cd data/data/com.your.package
ls
Then navigate through all your files
for reference https://stackoverflow.com/a/16461386/4804264
Android eclipse DDMS - Can't access data/data/ on phone to pull files
On rooted device you can do this:
- Open cmd
- Type
adb shell
su
- Press 'Allow' on device
chmod 777 /data /data/data /data/data/com.application.package/data/data/com.application.package/*
- Go to the DDMS view in Eclipse
After this you should be able to browse the files on the device.
To get the databases:
chmod 777 /data/data/com.application.package/databases /data/data/com.application.package/databases/*
If it returns permission denied
on su
Go to Settings
> Developer Options
> Root access
> Apps and ADB
Android Eclipse DDMS - Can't pull file from rooted device
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
Simple save file doesn't show in ddms and can't find the file on my device?
I also had same problem.
I think your file is in below path.
In eclipse :- Open File Explorer -> mnt -> shell -> emulated -> 0 -> DIRECTORY_PICTURES.
I hope this answers your question.
Eclipse-Android-SDK: DDMS: File-Explorer doesn't open folder
(Only for rooted device)
You must edit permission of data folder.
Root your device.
then go to " http://www.appsapk.com/root-explorer " download & install in your device.
open the app, then On top select "Monunted as r/w"
then press over data folder (long click) and find Permission option
Have a somenthing like that
read write execute
User
Group
Others
Make sure that "Others" have a check for read.
Do it for all the folders you want to access...
Then go to Eclipse and try again.
I hope it'll help you.
How to access data/data folder in Android device?
Accessing the files directly on your phone is difficult, but you may be able to copy them to your computer where you can do anything you want with it.
Without rooting you have 2 options:
If the application is debuggable you can use the
run-as
command in adb shelladb shell
run-as com.your.packagename
cp /data/data/com.your.packagename/Alternatively you can use Android's backup function.
adb backup -noapk com.your.packagename
You will now be prompted to 'unlock your device and confirm the backup operation'. It's best NOT to provide a password, otherwise it becomes more difficult to read the data. Just click on 'backup my data'. The resulting 'backup.ab' file on your computer contains all application data in android backup format. Basically it's a compressed tar file. This page explains how you can use OpenSSL's zlib command to uncompress it.
You can use theadb restore backup.db
command to restore the backup.
Can't open data directory on rooted android phone
Yet another option is to check the database using Root Explorer from the device itself. It can read .db
files. If you need to modify them, there is SQLite editor (by the same company), but I do not have much experience with it.
Update: I was playing with my phone after reaching this page: http://www.screaming-penguin.com/node/7742
Instead of the emulator as in that post, I had my phone connected to the usb (Samsung Captivate, custom 2.2 ROM), with usb debugging enabled.
I run the following commands, as an example:
$adb -d shell
# su
# cd /dbdata/databases/com.android.browser
# sqlite3 browser.db
sqlite> .tables
.tables
android_metadata bookmarks folders searches
sqlite> select * from bookmarks;
(listed all my bookmarks)
Basically, you can run any SQL command from adb on any database you open (provided you run it as su)
DDMS file explorer can't access data\data (HTC Desire HD)
SQLIte Database is actually just a file stored in phone memory, which you can copy to your phone SD card and then easily access it from your PC. Below is the function which does exactly what you need. Just make sure to change your package name and database name before using function.
public static void backupDatabase() throws IOException {
//Open your local db as the input stream
String inFileName = "/data/data/your.package.name/databases/database.sqlite";
File dbFile = new File(inFileName);
FileInputStream fis = new FileInputStream(dbFile);
String outFileName = Environment.getExternalStorageDirectory()
+ "/database.sqlite";
//Open the empty db as the output stream
OutputStream output = new FileOutputStream(outFileName);
//transfer bytes from the inputfile to the outputfile
byte[] buffer = new byte[1024];
int length;
while ((length = fis.read(buffer))>0){
output.write(buffer, 0, length);
}
//Close the streams
output.flush();
output.close();
fis.close();
}
As you may observe from the code, database is always stored in the folder:
/data/data/your.package.name/databases/
Name (in our example "database.sqlite") is the one you picked when extending SQLiteOpenHelper. Obviously, you also need to replace "your.package.name" with the name of your application package.
Related Topics
Removing Log Call Using Proguard
Why Is Android Geocoder Throwing a "Service Not Available" Exception
Listing All Extras of an Intent
How to Add a Library (Android-Support-V7-Appcompat) in Intellij Idea
How to Change the Spinner Background in Android
Is There a Better Way to Refresh Webview
How to Use Sharedpreferences in Xamarin.Android
Android and Setting Width and Height Programmatically in Dp Units
Android/Webkit Text-Overflow: Ellipsis Not Working
How to Programmatically Scroll a Scroll View to a Specific Edit Text
Reading Text File from Server on Android
Alert Dialog from Android Service
How to Create Edittext with Cross(X) Button at End of It
How to Get a Working Vertical Seekbar in Android
Get JSONarray Without Array Name
Connect an Android Device to a Web Service on Local Host
Losing Data When Rotate Screen
Creating a Searchview That Looks Like the Material Design Guidelines