Android reindex gallery

Android-reindex-gallery-featured.jpg

[Howto] MediaStore Database Rebuild (Album Art, Music, Video, Fiiles)
Walk-through Steps:

Media content and content on SDCard are indexed as Part of a MediaStore database on Android 3.0 and higher. Each version of Android has become more dependent on the mediastore database to find and organize content. In ICS its used for just about everything. Which means a corruption in the MediaStore Database can cause many wierd problems including:

Duplication files/directories appearing in Internal/External storage when viewed via USB connection to PC
AlbumArt/Descriptions being scrambled in Music Player
Music/Videos saying “Not found” when being played from Gallery or Music Player
Files not being able to be deleted from internal/external storage when viewed by USB connection to PC
Files visible via a file manager on the Xoom in /mnt/sdcard or /mnt/external1 but not visible from PC
Switching out SDCard still shows first cards directory content when connected to a Windows/Mac via USB

There are two ways to fix it:

One is to move all your content off the xoom, reboot the Xoom and let it try to rebuild the database. Then move the content back. This doesn’t always work as sometimes it doesn’t remove phantom entries.
The second way is much more heavy handed and involved deleting/clearing the mediastore database completely and letting it be rebuilt database from scratch.

Clearing the mediastore database and having it rebuilt from scratch involves the following steps. This doesn’t delete content from your Xoom, it just deletes the database that points to the content. Deletion of the database causes the database to be rebuilt from scratch based on what MediaScanner services sees on your device.

Goto Settings->Apps
Select ALL apps tab
Scroll down “Media Storage” application
Select It
Stop the Service
Select Clear Data
Make sure Xoom is not connected to your PC
Do full shutdown of your Xoom, then power it back up.
Wait 5-10 minutes as content is reindex. As its being reindex it is normal that you won’t see anything in your Music player, gallery, or even when connected to your PC.
Check your Gallery or Music application to see if content has start to reappear. Don’t panic if it hasn’t yet. Give it another 5-10 minutes. If it hasn’t appeared then try powering off and rebooting Xoom a second time.
If content doesn’t start showing up after second reboot, Download and run the ScanMedia application from the Android market: https://market.android.com/details?id=com.dcd.scanmedia
Start the reindexing process from the application.
Once reindexing is done your content should be visible in Gallery, Music Player, and you should be able to browse SDCard and internal storage from PC again without directory duplication/errors

Why is this all necessary?

Applications such as Music Players, Gallery applications, and even USB connection to PC all do the file looks ups from the MediaStore database. As its much faster than enumerating through all storage on the drive. And the MediaStore database has advantage of storing other information that can’t be stored in flat file system like thumnail and album information. Many applications improperly interface with the MediaStore database and can accidently create duplicate entries in database that point to a single file, or sometimes can delete entries that should point to files. These problems then manifest themselves in the applicaitons that use the database.

For example the USB connection from PC to Xoom uses the database for the directory listing. If a bad file manager has created duplcate database entries pointing to same file, the Windows box will show duplcate directories. Or if file manager created a file on the SDCard but did not create a dataase entry, windows won’t see it at all.

The upgrade to ICS has meant that the MediaStore database is being used for many more applications and programs on the Xoom, which means its integrity is much more important than it was before. In many cases the only real way to get the database back to a clean state it to reset it, and let the MediaScanner process in the Xoom rebuilt the database. This database rebuild process should start at boot on the Xoom, but sometimes it can take awhile or it pauses to minimize impact to user. The Media Scan type applications on the market basically just force the MediaScanner service to do its job regardless of performance impact, to make sure content gets reindex immediatly.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>