Music stored on the External SD Card is removed from playlists at reboot So I'm getting a really frustrating issue happening with my phone wherein any .mp3 files stored on my external SD card are removed from their playlists whenever I restart my phone. Any music stored on the internal phone storage still remains in the playlists but everything else gets cleared out of them. I've taken a look into the Media Store's SQL logs and found this:



Basically, I cleared the Media Store's data to reset the Android media database, then I rebooted. On the first reboot, all my playlists displayed perfectly (external SD music AND internal SD music). This produced the 3 log lines above the highlighted line in the image. Then I restarted my phone again and once again all the music on the external SD card was erased from my playlists. Restarting gave the log lines below and including the highlighted line. What seems to be happening is Android is removing any reference to files stored on my external SD from the Media Store database at reboot, then it rescans when the phone starts, but it generates the playlists BEFORE it scans the external SD for media, so it just thinks there's loads of missing media in the playlists and removes any reference to external SD music. Then it scans the external SD for music and finds all my media there.

So in the end I can still access all the music stored on my external SD and my phone sees it just fine, it's just that it's never maintained in any playlists. If anyone has any method of fixing this or any advice at all, I'd really appreciate it! I don't have enough room on my internal SD to store all my music.

Thanks!

(I'm on a Google Play Edition Galaxy S4 running Android 5.1)
After more experimentation, I've made a breakthrough. Ultimately, this all happens cause Android's Media Scanner will scan the internal SD for media at startup. When it finds Playlist files it attempts to import them into the system database but because the SD card takes a while to mount at startup and is temporarily unreadable for a while at boottime, when it tries to follow the path back to the music on the SD card it can't find the music since the SD card is still mounting. Instead of, yknow, doing anything logical like waiting for the SD to mount, it just erases the entries from the playlist. So to get around this stupid flaw in the system, you need to move all your playlists (.m3u/.pla/etc files) to the external SD card.

By moving the playlist files to the SD card, it ensures that they only ever get read once the SD card has finished mounting and the Media Scanner then attempts to scan the external SD for media. At this point it finds the playlists and follows their mp3 file paths back to the finally loaded Music folder on the external SD.