When you try to open a document, picture or video on Android, the system automatically suggests a default application - or asks which one to use. This logic works thanks to file associationsthat associate extensions (for example, .pdf, .mp4) with specific apps. But what if Android opens files with the wrong application? Or if the desired app does not appear in the list at all?
In this article we will look at where are file associations physically stored in Androidhow to change them through standard settings, and also consider advanced methods using ADB system files. We will pay special attention to problems that arise after resetting the settings or updating the OS, when the bindings are reset to factory settings.
It is important to understand: the association mechanism depends on the version of Android. Starting from Android 10Google has tightened controls over default apps, and in Android 13+ added additional security restrictions. We will take into account all the nuances so that the instructions work on modern devices.
What are file associations and why change them
A file association is a rule by which Android determines which application should open a file with a specific extension. For example:
- ๐
.docxโ Microsoft Word or Google Docs - ๐ต
.mp3โ Google Play Music or VLC - ๐น
.mkvโ MX Player or Kodi
By default, Android prompts you to select an application when you first open a file and remembers the choice. However, sometimes this mechanism breaks down:
- ๐ After updating the OS, all associations are reset.
- ๐ซ The application has been deleted, but the association remains (files cannot be opened).
- ๐ A virus or malware has replaced the default applications.
- ๐ฑ The smartphone manufacturer (Samsung, Xiaomi, Huawei) blocks changing some associations.
Changing associations allows you to:
- ๐ ๏ธ Restore the functionality of files after a failure.
- ๐ Regain control over opening files (for example, replace the standard player on VLC).
- ๐ Block unwanted applications that arbitrarily assign themselves as default.
Where file associations are stored in Android: system paths
File associations in Android are stored in several places, depending on the type of binding:
| Type associations | Path in the system | Storage format | Can I edit without root |
|---|---|---|---|
| Default applications (MIME types) | /data/system/users/0/package-restrictions.xml |
XML | โ No |
| File extension associations | /data/system/users/0/mime_types.xml |
XML | โ No |
| User settings (application selection) | /data/data/com.android.providers.settings/databases/settings.db |
SQLite | โ No |
| Association cache (temporary data) | /data/system/package.xml |
XML | โ No |
All these files are in a protected area /data, and editing them requires root access or access through ADB with debugging commands. Without them, you can only change associations through standard Android settings (more on them in the next section).
Important: starting with Android 11, Google has prohibited direct modification of files in /data without root, even through ADB. This is done for security, but complicates manual configuration.
โ ๏ธ Warning: editing system files without root can lead to data loss or cyclic reboot devices. If you are not sure of your actions, use only official methods (Android settings).
How to change file associations through Android settings
The safest way to change default applications is to use standard settings. The instructions are suitable for all versions of Android (from 6.0 to 14+), but the path may differ slightly depending on the shell (MIUI, One UI, ColorOS etc.).
Open Settings โ Applications|Select Default applications or Application settings|Find the section Opening supported links or Set as default|Select the file type (for example, Audio, Video, PDF)|Specify the desired application from the list-->
If the required application is not in the list, follow these steps:
- Install the application from Google Play (for example, FX File Explorer for working with files).
- Open any file of the appropriate type manually (via a file manager).
- In the window that appears, select the desired application and check the box
Always(orUse as default).
On some devices (for example, Samsung Galaxy s One UI) the path may look like this:
Settings โ Applications โ Three dots (โฎ) โ Default applications โ Set as default
โ ๏ธ Attention: manufacturers often block changing associations for system applications (for example Galaxy Store or Mi VideoIn this case, only ADB or root will help.
Advanced methods: changing associations via ADB
If the standard settings do not help (for example, the application does not appear in the list or the system ignores your choice), you can use ADB (Android Debug Bridge). This method works without root, but requires the computer to be turned on. USB debugging and computer.
First connect the phone to the PC and run the command to reset everything associations:
adb shell cmd package reset-preferred-packages
If you need to reset associations for a specific application (for example, Chrome), use:
adb shell pm clear com.android.chrome
To force the default application for a specific file type (for example, .mp3 โ VLC):
adb shell cmd package set-home-activity com.android.vlc/org.videolan.vlc.gui.video.VideoPlayerActivity
Full list of commands for working with associations:
| Target | ADB Command |
|---|---|
| Reset all associations | adb shell cmd package reset-preferred-packages |
| Reset associations for the application | adb shell pm clear [package_name] |
| View current associations | adb shell dumpsys package |
| Set the default application for MIME type | adb shell cmd package add-preferred-activity [package_name] |
Example: to force Google Photos to open all images, run:
adb shell cmd package add-preferred-activity com.google.android.apps.photos
If the command does not work, check if USB debugging is enabled in the developer options (Settings โ About phone โ Build number (7 times) โ For developers โ USB debugging).
Manual editing of system files (for root only)
If you have root access, you can manually edit association files. To do this:
- Install a file manager with root support (for example, Root Explorer or FX File Explorer).
- Go to
/data/system/users/0/and find files:package-restrictions.xmlโpackage restrictions.mime_types.xmlโMIME type bindings for applications.
<package name="com.example.app"><activity name="com.example.app.MainActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="audio/mp3" />
</intent-filter>
</activity>
</package>
After editing, check that the files have the correct permissions:
chmod 644 /data/system/users/0/package-restrictions.xml
chmod 644 /data/system/users/0/mime_types.xml
โ ๏ธ Attention: incorrect editing of XML files can lead to system crash or data loss. be sure to create a backup copy through TWRP or Custom Recovery.
What to do if after editing the system does not start?
If Android does not boot after changing system files, try:
1. Go to Recovery Mode (usually Power + Volume Up).
2. Restore the backup copy of files from the backup.
3. If there is no backup, reset to factory settings (Wipe Data/Factory Reset).
4. As a last resort, reflash the device via Odin (for Samsung) or Fastboot (for Google Pixel, Xiaomi etc.).
Problems with file associations and their solutions
Even after changing the settings, problems may occur. Let's look at typical cases and ways to solve them:
| Problem | Possible cause | Solution |
|---|---|---|
| The application does not appear in the list for opening the file | The application has not registered MIME type support c AndroidManifest.xml |
Update the application or use ADB to force assignment |
| Android ignores the default application selection | The manufacturer has blocked the change (for example, Huawei, Xiaomi) | Use ADB or disable the system application via pm disable |
| After updating the OS, all associations were reset | Android resets default settings during major updates | Restore the settings manually or via ADB |
| Files are opened by unknown application | Malware has replaced the associations | Check your device for viruses and reset the associations via ADB |
If the problem is related to a specific manufacturer, try the following solutions:
- ๐ฑ Samsung: disable
Knoxin the settings security or useADBto bypass restrictions. - ๐ฑ Xiaomi: enable
Developer modeand disableMIUI Optimizationin the settings. - ๐ฑ Huawei: some associations are blocked at the firmware level - only flashing will help.
If standard methods do not work, try resetting the application cache Settings via Settings โ Applications โ Three dots (โฎ) โ Show system โ Settings โ Storage โ Clear cache.
How to prevent file associations from being reset
To avoid losing association settings, follow these recommendations:
- ๐ Back up your files regularly
package-restrictions.xmlandmime_types.xml(if there is root). - ๐ฅ Before updating the OS, reset associations via
ADBto avoid conflicts:adb shell cmd package reset-preferred-packages - ๐ก๏ธ Install an antivirus (for example, Malwarebytes) to protect against software that changes associations.
- ๐ฑ Avoid using "optimizers" and "cleaners" (for example, Clean Master), which often reset settings.
If you often work with files of different types, consider using file managers with their own associations, for example:
- ๐ Solid Explorer โ allows you to assign applications to open directly in the interface.
- ๐ FX File Explorer โsupports manual management of MIME types.
- ๐ Total Commander โhas a built-in editor associations.
For corporate devices (for example, managed Android Enterprise), association settings can be controlled by the administrator via Device Policy Controller. In this case, they can only be changed through the MDM console.
FAQ: answers to frequently asked questions
Is it possible to change file associations without root and ADB?
Yes, but only through standard Android settings (Settings โ Applications โ Default applications). However, some manufacturers (for example Xiaomi or Huawei) block the change for system applications In this case. You can't do without ADB or root.
Why were all associations reset after updating Android?
This is standard Android behavior during major updates (for example, from 12 to 13). The system resets the settings to default to prevent conflicts. To avoid this, before updating, run the command:
adb shell cmd package reset-preferred-packages
This will reset all associations in advance, and after the update you can configure them again.
How to find out which application opens the file by default?
There are several ways:
- Try opening it file - Android will show the current application by default.
- Use
ADBto view the current associations:adb shell dumpsys package | grep "Preferred activities" - Install the application App Inspector from Google Playwhich shows all MIME types and associated applications.
Is it possible to assign one application to all file types?
No, Android does not support assigning one application to all file types. Each MIME type (for example, audio/mp3, video/mp4) is assigned separately, however, some file managers (for example, Solid Explorer) allow you to group similar ones. types.
What to do if the file is not opened by any application?
This means that the device does not have an application that supports this MIME type. Solutions:
- Install a specialized application (for example, VLC for video WPS Office for documents).
- Check the file extension - it may have been changed (for example,
.pdf.exeinstead of.pdf). - Use Google Drive or Dropbox to preview the file in cloud.