AdMob breaks MaterialYou dynamic color update on Android 15

1 day ago 1
ARTICLE AD BOX

As soon as I add

MobileAds.initialize(this)

The dynamic color update does not work anymore.

When I switch the OS color palette and go back to the app, the colors do not update. I need to restart the app to get the update. When I comment the above line out, it works.

I can reproduce this by:

Using an Pixel 8 API 35 emulator

creating a new blank project in Android Studio

add implementation("com.google.android.gms:play-services-ads:25.1.0")

Add some sample AdMob ID

<!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 --> <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-3940256099942544~3347511713"/>

Add this to MainActivity onCreate

override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) val systemColor = this.getColor(android.R.color.system_accent1_500) Log.d("MainActivity", "ColorCheck onCreate. systemColor $systemColor") MobileAds.initialize(this)

Now, when I return to the app after OS color palette switch, the log always prints the same value, as long as I restart the app.
Without the MobileAds initialization, it works fine.

I found this google groups post for the same issue. But it seems like the support was shut down and also there was apparently no progress since one year.
https://groups.google.com/g/google-admob-ads-sdk/c/_W6lrx8SCdY

Does anyone have a clue how this issue could be circumvented?

Edit: Now I saw also this thread which could be the underlying issue: https://issuetracker.google.com/issues/382864248
Also for me it works on Android 14 as well as Android 16 emulators, but not on Android 15.

Read Entire Article