Edit:
To continue using version 1.1.0 add this below your attachBaseContext
:
Kotlin solution:
override fun applyOverrideConfiguration(overrideConfiguration: Configuration?) {
if (overrideConfiguration != null) {
val uiMode = overrideConfiguration.uiMode
overrideConfiguration.setTo(baseContext.resources.configuration)
overrideConfiguration.uiMode = uiMode
}
super.applyOverrideConfiguration(overrideConfiguration)
}
Java solution:
@Override
public void applyOverrideConfiguration(Configuration overrideConfiguration) {
if (overrideConfiguration != null) {
int uiMode = overrideConfiguration.uiMode;
overrideConfiguration.setTo(getBaseContext().getResources().getConfiguration());
overrideConfiguration.uiMode = uiMode;
}
super.applyOverrideConfiguration(overrideConfiguration);
}
If you don't need to upgrade to the latest appCompat
then check the
old answer. Else use the solution provided by @0101100101
here.
Old Answer:
After spending hours trying, got to know that it might be a bug.
Downgrade to the last stable version and it works flawlessly.
dependencies {
implementation 'androidx.appcompat:appcompat:1.0.2' //************ DO NOT UPGRADE LANGUAGE ISSUE on API 23 and below *******************//
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
....
}
Meanwhile, I have filed an issue with Google https://issuetracker.google.com/issues/140880275
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…