I'm new to android development. I want to create a music player that functions in a client-server fashion. I'm trying to create the server part for now. I found out that I could achieve this using MediaBrowserServiceCompat
as it says in the official documentation here. But when I tried to use it in my project it says Unresolved reference: MediaBrowserServiceCompat
Although I've set Android Studio to import needed libraries automatically, I tried importing
android.support.v4.*
, android.support.*
, androidx.*
explicitly, hoping it might work but it didn't as it turns out. So I went over to the GitHub repo of UAMP(Universal Android Music Player) for some help. I found the statement import androidx.media.MediaBrowserServiceCompat
in this file. But I couldn't find any library named so
And why my Manifest says MediaPlaybackService must extend android.app.service
?
How am I supposed to use it? Thanks!
Edit: I did a little bit of research and tinkering. I tried changing the service name in my Manifest and the associated class name as well to MyMediaBrowserServiceCompat
and magically it worked(sort of). So now, my question is, is it normal behavior? Should changing the service name really affect this situation? And if its so, how on Earth it works with different names(something not similar to the class name itself) on other peoples' machines? And secondly, now my code says There's a cycle in the inheritance hierarchy for this type
I searched the web and found this. So I know what that message means but I can't figure out how to solve it in this case. And my Manifest still says the same:
MyMediaBrowserServiceCompat must extend android.app.service