I want to change theme of app (actually I need to change windowBackground only) in build time, depends on my environment.
styles.xml
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
</style>
<style name="AppTheme.WithSplashScreen" parent="AppTheme">
<item name="android:windowBackground">@drawable/window_background</item>
</style>
</resources>
I tried manifest placeholders and inject theme name into manifest app/build.gradle
defaultConfig {
manifestPlaceholders = [app_theme:"@style/AppTheme.WithSplashScreen"]
//...
}
AndroidManifest.xml
<application
android:theme="@{app_theme}">
but I got an error
app/android/app/build/intermediates/manifests/full/debug/AndroidManifest.xml:56:24-44: AAPT: No resource type specified (at 'theme' with value '@{app_theme}').
Maybe appt expects id of theme resource form R.class, but I am not sure how to reference to that from gradle file. Or there should be other way.
I can't apply themes in runtime because I want window-background appear immediately .