I was optimistic when I wrote that last spring it only took a few minutes to sync my iTunes library to my Android phone. Having done it a couple of times now in debugging an issue with my new music player I can say it takes a several hours. And after that it takes some addition but hard to measure time for the Android Media Storage to rebuild its database once you’ve wiped it.
The Mikado Has Gone Missing
All this because I did not see The Mikado in my Operetta genre. I don’t have many Gilbert & Sulivan operettas in my collection so it was pretty obvious that one was missing. I have no idea if one of my symphony or Broadway musical recordings is missing because the number of albums in those genres is quite large. I have scanned over the list of albums my app shows and compared it to the albums iTunes shows but that is a manual check and could easily miss a difference.
Maybe The Problem Is In My New App
At first I thought it was a “off by one” error of some sort in my app but I could not find any code that looked wrong.
Since the app works by querying for all the songs/tracks in a genre to build a playlist. Then the playlist is scanned to build a index of albums. It is only possible for an album to be missing if all the songs/tracks on that album are missing. Looking at lots of other albums, I don’t see any with obviously missing songs/tracks. And, to cap it off, even if the album index was missing the album the songs would still be in the playlist and they are not.
Maybe Not My App’s Problem?
Then I noticed that every other music playing app I have fails to show songs/tracks for The Mikado in the Operetta genre even when they show it using a general album view or straight song view. You can play any or all of the tracks in the album once you find them, so the MP3 files are on the phone, not horribly corrupt and were indexed into albums by Android’s Media Storage. If several apps that have no other visible issues finding music tracks have the same problem as mine finding the songs on that album in that genre, then it is likely the problem is not in my app.
Maybe Bad Metadata?
There might be a problem in the metadata on the song/tracks on that album. But nothing is visibly wrong when I look at that in iTunes on my laptop. I’ve consistently used iTunes on my laptop to edit track metadata, so whatever version of the MP3 metadata specification iTunes uses has been consistently used on all other tracks and albums in my collection.
I’ve now wiped all the music off the phone a couple of times and forced the Media Storage to rebuild its database a couple of times with different metadata tagging trying to narrow down the issue. Thus I know now my memory of “a few minutes” to sync the music from the laptop was optimistic, its more like “a couple hours”.
Android Media Storage Seems To Be The Most Likely Candidate Left
My current working hyphothesis is a problem in Android Media Storage software. There have been bugs reported, and reported as fixed, in the past. And there are others who still apparently still have the issue after the bug fix. Though with Android’s version fragmentation it is unclear if the people reporting problems are running older versions of the system. (I am on 7.1.2 with the July 2017 security update and that is the most current I can be.)
I guess I’ll poke at the issue and see if I can characterize it better. Or maybe find a work around. But I don’t have a lot of hope for an easy solution.
22-July-2017 – Updated Observations
Using other music players and TagMusic to examine things, none of the tracks on this problematical album have metadata available through Android Media Store. No artist, no genre, no track number, no year. All missing.
If the tags are added via TagMusic, it claims success but when the tag information is again retrieved from Media Storage they are still missing.
There appears to be no logging on this, the failure to update the tags is a silent failure. Same thing if I trigger a media rescan, I see a message in logcat saying it has received the intent but that is about it:
07-22 08:22:13.793 8938 8938 D MediaScannerReceiver: action: android.intent.action.MEDIA_MOUNTED path: /storage/emulated/0/Music
No messages indicating errors or inability to read the metadata from a file. Nothing. This is really strange. . .
Removing the problematical album and re-importing them from the original audio CD has fixed this problem. This was after trying lots of ways of editing or repairing the ID3 tags on the MP3 files. There must have been some sort of issue that Android Media Store had reading the metadata from the files but lacking any log messages from Media Store and not having issues with those tags with any other software makes it impossible to say what the issue(s) were.