I searched a lot in DDMS all folders but can not find the location of my package folder in file manager. I have search it into the storage/sdcard0 but there also my package is not present.
take a look I uploaded photo. Is there any special setting from mobile ?
My phone android version 4.4.2
please help me to find.
UPDATE
I gone through this steps.
And I reach to My database folder .Now What to do.
adb shell
run-as com.mypackage
ls
cd databases
ls
Now After this what to do.
As you are looking for the database.
I used to copy the database file to any other location after updating it. ( in my code)
Then I use any sqlite viewer over phone or over PC to view it.
I Think you need a rooted device
as far as I know the files on sdcard/Android/data are not the primary files for the packages, those are only extra files (most probably not critical and large files) which are saved on the external storage which is the sdcard.
main package files are saved on the internal storage.
I think you can try this link
http://developer.android.com/guide/topics/data/install-location.html
you can change the location of app installation.
Br,
You can't see the files in DDMS, but you can get a list of the location of all the files using the command:
adb shell pm list packages -f
(you can also add an optional extra parameter to restrict the files listed to be those that match your extra parameter).
Once you have the location of the file, you can then issue a command like
adb pull /system/app/GoogleEarth.apk
to actually get the file off the device and on to your PC.
None of this requires a rooted device.
Since you're looking for the database of your application: Unfortunately there's no way to access the /data/data/your.package.name/databases through DDMS on an unrooted device, as Hussein Ali pointed out correctly. (By the way: The app-data (shared prefs, databases) will reside there no matter of the install-location)
Something like this won't work neither because of Permission denied.
adb pull /data/data/your.package.name/databases/db.sl3
Luckily ICS (Android 4.0) introducted the ability to backup your application-data. That's a possible way to copy your database from your unrooted device to your PC. Please see this post on StackOverflow in order to see what you need to do.
copy the database file to your SD card so you'll be able to use adb pull and get the database to your PC (You can't pull files from private folders such as /data/data/...).
I recommend using SQLite Expert to browse the DB on your desktop:
http://www.sqliteexpert.com/
Also, If you still want to use sqlite3 on your device, check out this answer: https://stackoverflow.com/a/7878236/624109
phone storage is treated as external storage in location "sdcard" where you havn't saved anything so nothing(package named folder) is created... your package will be in app's "private storage" that's in root "data/data/pkg_name" folder accessible only on rooted device.
Related
I use SQLite as my offline database. After the APK installation, I couldn't find the folders that I made. I want to put the database in device Storage : /storage/emulated/0 (Samsung device where I tested my program).
I already put this in my manifest :
<manifest android:installLocation="preferExternal" />
To install APK, i copied it directly from bin to my phone external storage. Did I miss something?
**notes: I need for users to be able to access files (.TXT and .XML) from device storage, so the folders and files inside shouldn't be hidden.
I'd appreciate your kind reply.. Thanks
installLocation="preferExternal" refers to the app installation, not to an eventual database (which I don't see mentioned anywhere in your question, other than in its title).
i copied it directly from bin to my phone external storage. Did I miss something? YES: this is not enough.
You have to install the apk, after copying it - you'll need a file manager to launch it.
OR (better) activate your Debug Options and run the app from the IDE directly onto your phone (you'll need to install the ADB Bridge, aka USB driver, aka ADB Composite Interface).
so the folders and files inside shouldn't be hidden. Every file in the apk is private to your app.
Other than this, your SD Card and then use them from there.
Use Environment.getExternalStorageDirectory() to get the path to your SD Card.
If you need some clarification on databases, please post a specific question about that matter.
I opened a SQLite database in my project. To see if the db was actually created I went to Data/Data to find the package name... not there. While testing I would like the ability to delet the file.
So I added data to the db, then read it out. This works fine, but still no file at either /Data/Data, or at /Android/Data/Data. Is the file hidden? Other dowloaded aps have data at /Data/Data/package/... but not the one I wrote. It does exist - I can read and write to/from it, but cannot find it.
//data/data/Your-Application-Package-Name/databases/your-database-name NOT THERE
Using a Samsung Galaxy Nexus for testing, not the emulator. The Nexus does not have external SD memory card.
SQLite databases are only accessible to the creating project, but is there a tool that can access it externally? I have sqlitebrowser (awsome) i will try if I can find the file.
I would try to Root the Nexus, but I can already see /Data/Data/ other items/Data/their data, so hopefully I do not have to go that route.
You're not able to access any contents of /data/data if you access it from adb shell without first rooting the device. Shell is considered as another app (more precisely another linux user), so it's prevented from accessing other app's data in /data/data.
Root the device or use emulator to see the data.
Personally I really recommend rooting the device for development.
I am working with SQLite in an App. It writes to the database, etc., with no problem. However, I can not find this new database. I have tried changing the directory with cd /data/data/packageName/databases, but it says "no such file or directory". Also, this database is not found when I click on the File Explorer in eclipse. My logging tells me the database was created and that it is being written to. I think I need to set the path in the shell or something to that effect using adb, but I have no idea how to do that. Can anyone give me some instruction? Also, I am using my phone for development. The database also does not show up when using the emulator.
Thanks very much.
Matt
Matt,
This thread gives a good explanation on why you might not be able to access the data folder on your phone.
Can't access data folder in the File Explorer of DDMS using a Nexus One!
You can still test the Sqlite code though. Just boot up an emulator. The emulator will have no access restrictions. Once it's booted up you can use the ddms tool (located in the tools directory under your android SDK install folder). It has a File Explorer and you can download the files from the /data folder.
Also, I am using my phone for development.
You cannot access the database on a standard Android device except via your own application code.
Your options are:
Do this sort of testing on an emulator, in which case you can access the directory that you are failing to access on the device
Add a database backup feature to your app, that copies the (closed) database to external storage, so you can examine it
Root your phone (leastways, I am under the impression this can help get you to this directory -- haven't done it myself)
The database also does not show up when using the emulator.
Try harder. If you can store data in the database and read data out of it using SQLiteDatabase, then the database file is there.
I've been trying to pull a copy of my sqlite database from my android app for dev. My first attempt was to call:
./adb shell
cd data/data
cd com.example.app
cd databases
But then I get stuck here as I do not have permission to do a pull or even view the files in that dir!
So I thought I'd try out the DDMS File Explorer which gives me this:
But when I try and pull files from here (I would expect them to be in the data folder) it just pulls the directory and nothing else. How can I do this to pull a copy of the database my app is creating/using?
I have tried this when the phone is on the SD card and on phone memory. I guess I could copy to SD card and then plug the SD card to pc rather than the phone and do it that way? Not sure if it would work and would be rather annoying to dev like that!
Thanks
If your device does not give you access to this directory (and your device is not rooted -- if you become root, you'll have access), you will need assistance from your application.
The application can, for example, copy databases/your_database_name.db to a readable location, perhaps on the SD card. Then you can pull from there.
IF you just need the DB for general checking/viewing you can run your app on the emulator and get the DB from there. If you need the specific instance on your device you need to root your device as others are suggesting.
Where does the emulator data lie(the contacts, messages, saved images)?
Go to ddms,you can find the file explorer from that you will get application directry and sd card filed you can find all the detailed files there.
In ~/.android (that is your user directory/.android)
Each application stores its own data in its own private folder in /data/data on the emulator. Depending on the application it potentially can also store data on the /sdcard (e.g. downloaded images or whatever) which by convention should then be in /sdcard/Android/data/com.yourappspackage.and.so/ so that it gets cleaned up with uninstall but many apps also throw stuff all over the sd card (although they should not..)
More is on the dev site e.g. at http://developer.android.com/guide/topics/data/data-storage.html
All this is the same for the emulator as well as the real device. The emulator is just a virtual machine running on qemu.
You can use File Explorer tool in eclipse or ddms to View The data in the emulator
else use terminal to view the data using the command,
adb shell
Thank you,
Ganapathy.