When I try to make changes to the splash screen and reinstall the application, the splash does not change.
It's strange that sometimes (the next day) changes are picked up on the first build. It`s really magic that splash stay the same when I change color and reinstall app.
I am debugging on ZTE Benefit M8 Android 7.1.2 (custom firmware).
app module
->res folders
:
- values/splash_theme.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.App.Starting1" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">#069056</item>
<item name="windowSplashScreenAnimationDuration">1000</item>
<item name="postSplashScreenTheme">@style/Theme.NextTheme</item>
</style>
</resources>
- values-night/splash_theme.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.App.Starting1" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">#ff1212</item>
<item name="windowSplashScreenAnimationDuration">1000</item>
<item name="postSplashScreenTheme">@style/Theme.NextTheme</item>
</style>
</resources>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name="myApp.app.App"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
tools:targetApi="31">
<activity
android:name="myApp.presentation.MainActivity"
android:exported="true"
android:launchMode="singleTask"
android:theme="@style/Theme.App.Starting1">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
build.gradle.kts
plugins {
id(Dependencies.Plugins.application)
id(Dependencies.Plugins.kotlin)
id(Dependencies.Plugins.kapt)
id(Dependencies.Plugins.serialization)
id(Dependencies.Plugins.parcelize)
}
android {
namespace = Config.Namespace.App
compileSdk = Config.Sdk.compile
defaultConfig {
applicationId = Config.applicationId
minSdk = Config.Sdk.min
targetSdk = Config.Sdk.target
versionCode = Config.Versions.code
versionName = Config.Versions.name
testInstrumentationRunner = Config.Test.instrumentationRunner
}
buildTypes {
release {
isMinifyEnabled = Config.Release.minifyEnabled // false
proguardFiles(
getDefaultProguardFile(Config.Release.Proguard.name),
Config.Release.Proguard.rules
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = Config.Kotlin.Options.jvmTarget
}
buildFeatures {
viewBinding = true
}
}
dependencies {
implementation(project(":core"))
implementation(project(":core-ui"))
implementation(Dependencies.Default.core)
implementation(Dependencies.Default.appCompat)
implementation(Dependencies.Default.material)
//Activity
implementation(Dependencies.Lifecycle.activity)
//Fragment
implementation(Dependencies.Lifecycle.fragment)
// ViewModel
implementation(Dependencies.Lifecycle.viewModel)
// Lifecycle
implementation(Dependencies.Lifecycle.lifecycle)
kapt(Dependencies.Lifecycle.lifecycleCompiler)
//Splash
implementation(Dependencies.splash) // androidx.core:core-splashscreen:1.0.0
...
}
MainActivity.kt
override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
super.onCreate(savedInstanceState)
getAppComponent().inject(this)
binding = ActivityMainBinding.inflate(layoutInflater)
.apply { setContentView(root) }
I try: invalid cache, restart, rebuild, clean, reinstalling dependencies by ./gradlew, reopen studio, delete app on device, rename splash theme, reconnect device with usb.