error: cannot find symbol class MediaStyle after migrating to androidx
In AndroidX, that specific style is located in a different package. You need to prepend the media style with 'androidx.media.app'.
In other words:
builder.setStyle(new androidx.media.app.NotificationCompat.MediaStyle());
Curiously enough, I didn't need to implement this package in my gradle file, so it could be something related to AndroidX internal dependencies.
for my case, i need to add the following to my gradle file to find NotificationCompat.MediaStyle() class.
implementation "androidx.media:media:1.1.0"
https://developer.android.com/jetpack/androidx/releases/media
NotificationCompat.Builder(this, CHANNEL_ID)
.setStyle(new androidx.media.app.NotificationCompat.MediaStyle());
note that notificationCompat.Builder is in a different package (androidx.core.app.NotificationCompat) from MediaStyle.
Migrate android.support.v4.media.app.NotificationCompat
to androidx.core.app.NotificationCompat
This looks like same answer @karan gave above. But the classes are different. Took me days to figure out that androidx.media.app.NotificationCompat
was my problem.
The difference between the two; one is androidx.core...
, the other is androidx.media...