- Where Android apps store data?
- 3 Answers 3
- Does Android keep the .apk files? if so where?
- 19 Answers 19
- Where do I find app data in Android
- 2 Answers 2
- Where is android studio building my .apk file?
- Finding App Package and App Activity for Android App : Help Center
- How to find App Package and App Activity of your Android App
- Finding App Package and Activity
- Prerequisite for ADB
Where Android apps store data?
Could you list all possible directories where Android apps may store data, providing description what kind of data are stored in each directory?
3 Answers 3
All apps (root or not) have a default data directory, which is /data/data/
. By default, the apps databases, settings, and all other data go here. This directory is «private» to the app – which means no other app and not even the user can access data in it (without root permissions).
If an app expects huge amounts of data to be stored, or for other reasons wants to «be nice to internal storage», there’s a corresponding directory on the SDCard ( Android/data/
Apart from that, all apps can store data anywhere on the SDCard, as there are no restrictions — and many apps do so. They can use directory names freely (and they again do), which is what often makes it hard to decide what all that «junk» on the card is intended for, and what of it can be deleted.
Though, as Tom pointed out, root-apps could store their data almost everywhere on your device, they usually follow the same rules as other apps.
You can find a general explanation of the Android directory hierarchy in my answer here. For your specific question I might add some more details on the /data/data/
(and corresponding SD-part):
- databases/ : here go the app’s databases
- lib/ : libraries and helpers for the app
- files/ : other related files
- shared_prefs/ : preferences and settings
- cache/ : well, caches
There might be several more directories in this place, or fewer — it all depends on the app. In its own «home directory» (and that’s what it basically is, spoken Linux-wise) they can place files where they want. Usually, these files and directories are only accessible by the app itself (and root, of course) — other than those stored on the SDCard, which are accessible by all apps.
Some major changes occurred to storage in Android 4.4 (see Android’s Storage Journey). So the following is generally true for Android 4.4+ and particularly 6+.
This is from my detailed answer to How disk space is used on Android device?. Apps’ files are saved (by system and app itself) to internal and external storage under different categories.
All of the above paths on internal and external storage (primary and secondary) are app’s private directories which are accessible to respective app without requesting any permission. Apps can also create other directories (not explicitly available through APIs) in their private storage. All of these directories belonging to an app are deleted when the app is uninstalled.
Additionally apps can put their data anywhere on primary external storage (including some standard directories and other apps’ private directories) if WRITE_EXTERNAL_STORAGE permission is granted ( getExternalStorageDirectory returns /storage/emulated/ ). For secondary external storage and removable storage SAF is used. See details in How to save files to external SD card?.
However in Android 10 writing directly to primary external shared storage is deprecated ( getExternalStorageDirectory and getExternalStoragePublicDirectory are no more available). Apps need to use one of Android’s built-in content providers; either MediaStore (for media files) or SAF (for any other type of files).
/data paths may get replaced with /mnt/expand/[UUID] when using Adoptable Storage. /storage/emulated gets replaced with /storage/[UUID] when using secondary external storage (like SD card).
For multiple users/profiles is different, device owner is always 0 . /data/user/0 is a symlink to /data/data for historical reasons. Secondary external storage is only available to device owner.
OBB directory is shared among users/profiles (up to Android 9) to save space. FUSE/ sdcardfs always exposes /storage/emulated/obb as /storage/emulated/ /Android/obb .
/data/user_de is the Device Encrypted storage on FBE devices which lets certain apps run on boot without asking for user credentials.
/data/misc/profiles are used by ART for profile-guided compilation of app code.
Description of each directory is somewhat evident from names, details can be seen in API documentation.
Caches are cleared by OS when running low on storage, keeping apps exceeding the allotted quota on top.
Apps’ private files directories in external storage aren’t automatically scanned by MediaScanner but media directories are.
Caches and no_backup directories are not backed up to cloud. See official documentation.
Источник
Does Android keep the .apk files? if so where?
After android installs an application from the Marketplace, does it keep the .apk file?
Is there a standard location where Android would keep such files?
19 Answers 19
You can use package manager ( pm ) over adb shell to list packages:
and to display where the .apk file is:
And adb pull to download the apk.
Preinstalled applications are in /system/app folder. User installed applications are in /data/app . I guess you can’t access unless you have a rooted phone. I don’t have a rooted phone here but try this code out:
It does lists the apks in my rooted htc magic and in the emu.
If you just want to get an APK file of something you previously installed, do this:
- Get AirDroid from Google Play
- Access your phone using AirDroid from your PC web browser
- Go to Apps and select the installed app
- Click the «download» button to download the APK version of this app from your phone
You don’t need to root your phone, use adb , or write anything.
There is no standard location, however you can use the PackageManager to find out about packages and the ApplicationInfo class you can get from there has various information about a particular package: the path to its .apk, the path to its data directory, the path to a resource-only .apk (for forward locked apps), etc. Note that you may or may not have permission to read these directories depending on your relationship with the other app; however, all apps are able to read the resource .apk (which is also the real .apk for non-forward-locked app).
If you are just poking around in the shell, currently non-forward-locked apps are located in /data/app/.apk. The shell user can read a specific .apk, though it can’t list the directory. In a future release the naming convention will be changed slightly, so don’t count on it remaining the same, but if you get the path of the .apk from the package manager then you can use it in the shell.
Preinstalled Apps are typically in /system/app and user installed apps are in /data/app.
You can use «adb pull», but you need to know the full path of the APK file. On the emulator, you can get a directory listing using «adb shell» + «ls». But on an android device, you will not be able to do that in «/data» folder due to security reasons. So how do you figure out the full path of the APK file?
You can get a full list of all apps installed by writing a program that queries the PackageManager. Short code snippet below:
You can also find apps that will give such info. There are lots of them. Try this one (AppSender).
Install from marketplace
It’s the behavior of marketplace whether to keep the apk after installation. Google play doesn’t keep the apk after the installation. Other third-party marketplaces might have the different behaviors.
Install from development/debug tool (adb, eclipse, android studio)
When we install the apk from debug tool, directly invoke adb install or from eclipse/android studio, the apk will be transferred ( adb push ) to a public read and writable directory, usually /data/local/tmp/ . After that, the tool will use the pm command to install, it will delete the temporary apk in /data/local/tmp/ after the successful installation.
We could get these information from debug output like following.
How system keeps the apk
Of course the system have to store all apks somewhere. There are three places for the system to keep the apks based on the different types of apks:
Those are usually shipped in device by manufacture, including core app for system running and google service, you can find them under directory /system/app and /system/priv-app .
user installed app
Most of the apks fall into this category. These apks are usually installed from marketplace by users or by adb install without -s option. You can find them under the directory /data/app for a rooted device.
If the apk enable its install location in sdcard with android:installLocation=»auto» in its manifest, the app can be moved to sdcard from system’s app manager menu. These apks are usually located in secure folder of sdcard /mnt/sdcard/asec .
Anther way to force the install location to sdcard is using the command adb install -s apk-to-install.apk .
As a note, the files for pre-installed app are not in a single .apk file anymore. There is a folder containing files for every pre-installed app in the directory /system/app or /system/priv-app for the newest android release.
Источник
Where do I find app data in Android
My goal is to save data from app in a text file for further analysis. I used the exact code as given here for saving data:
The data is stored and retrieved according to the app, but I am not able to find MySampleFile.txt (even using the search functionality) on the phone.
I can’t find it in Android -> data -> com.*.*. I have a Samsung Galaxy S3. Is anything different in this phone?
Should I make any modifications in the phone?
2 Answers 2
Do the following to be able to see your data stored in the phone’s internal memory.
- Turn on USB Debugging on your phone.
- Connect your phone to the system.
- Open DDMS perspective in your Eclipse.
- Select your device from the devices tab on the left.
- On the right, the last tab will be File Explorer. Open that.
- Traverse to data/data/your.app.package to find the data you want to see.
P.S:- NEVER root your phone, unless you’re a developer who loves to mess around with the System apps.
To see data , you phone must be root . Samsung Galaxy S3 is not a root from vendor, you need to root your phone to access internal memory/storage, you can only access external memory/storage in your phone i.e. sdcard
But, i would suggest you to use Emulator rather root your phone.
Here, are some links about what is rooting, you can go through these:
But again I would suggest to use Emulator unless you are not expert enough to root and Install firmwares again when you don’t want your phone root.
Please use Emulator to see data->com.package
From Windows Menu->ShowView->Others->android->fileExplorer you can see the file in your device
Источник
Where is android studio building my .apk file?
I’ve been rebuilding my project from the ground up, so there’s been a lot of problems with it. At the moment, everything’s working great, except that when I try to run the app, I get the message ‘Local path doesn’t exist.’, where the local path is pointing at the path: AndroidStudioProjects\MyProject\MyProject..\build\production\MyProject.apk, and true enough, there is no .apk file at that location, or indeed anywhere else in the project filesystem.
However, I can build the app with no problems, and running gradlew packageDebug gives me the message ‘build successful‘, so .apks should be being generated. My question is, where are they going, or if they aren’t being generated, why not?
Where is the build path of each module set? I’m somewhat confused because the Project Structure->Facets->Android->Compiler settings, Project Structure->Modules->Paths->Compiler Output, build.gradle, and MyProject.iml all seem to have something to do with the build path, but I don’t quite understand how they relate
edit: I know where it should be, but it’s not there so I want to know how to change the build path
edit 2: For some reason running gradlew build does create .apks, but not building or running from inside the program
edit 3: Here’s my gradlew build output, note that it does build successfully:
Источник
Finding App Package and App Activity for Android App : Help Center
How to find App Package and App Activity of your Android App
Test Execution of Android applications in Testsigma(or in General) requires a few characteristic details about the Application in order to locate the Application and the specific feature in the Application that is to be tested. They are:
- App Package Name
- App Activity Name
Every Android app has a unique identifier that looks like a Java package name, such as «com.example.myapp«. This ID uniquely identifies your app on the device and in Google Play Store.
Furthermore, Each Android Application contains a number of Activities or Pages and each Activity contains a number of elements such as fields or buttons that we need to test.
A simpler analogy is,
«An Activity in an Android Application is to a Web page in a Web Application or Website»
Testing requires the App Package name to locate the Application and App Activity name to pinpoint the Page to be tested.
Finding App Package and Activity
We can find the App details using the Android Debugging Bridge (ADB) interface in a Command Prompt (Windows) or Terminal (Linux/Mac).
Prerequisite for ADB
- Android SDK should be installed and set up on the Computer.
Let us try finding the details of the Whatsapp app in this case. Please follow the steps given below:
1. Firstly, connect your Android device or emulator to the PC/Mac and open the App whose details you want to inspect i.e Whatsapp.
2. Open a Command Prompt or Terminal window and use ‘adb devices‘ command to see the list of connected devices. A list of Android devices connected to the Computer is displayed along with their device IDs as shown below:
For now, we have only one device connected to this System.
3. Finally, type the below-given command to get the information about the currently open application, i.e in our case, WhatsApp.
For Mac/Linux:
For Windows:
The Android Application Package name and Application Activity name are shown as given below:
Here, the part before the ‘/’ character i.e com.whatsapp is the Package name and the part after that i.e com.whatsapp.HomeActivity is the Activity name.
Note: We need to make sure that the WhatsApp application is opened on the device and device is not locked before the procedure. We can use the same method for finding the details of any Application installed on the device.
Info: You can also confirm the package name of an Application in the More Details section of the Application details page in Google Play Store.
Welcome to the era of #SmartTestAutomation!
Источник