android: fix AppCompat theme crash on launch
Some checks failed
Android CI / android (push) Has been cancelled
Android Release / release (push) Has been cancelled
CI / test (push) Has been cancelled

This commit is contained in:
Codex
2026-03-10 09:12:14 +03:00
parent e4ea18242a
commit f7b9753c2e
3 changed files with 12 additions and 2 deletions

View File

@@ -994,3 +994,13 @@
- copies `*Application_GeneratedInjector.class` from `intermediates/javac/.../classes` - copies `*Application_GeneratedInjector.class` from `intermediates/javac/.../classes`
into `intermediates/classes/.../transform...ClassesWithAsm/dirs` if missing, into `intermediates/classes/.../transform...ClassesWithAsm/dirs` if missing,
- wired task as dependency of `dexBuilder<Variant>`. - wired task as dependency of `dexBuilder<Variant>`.
### Step 135 - AppCompat launch crash fix (theme mismatch)
- Fixed `MainActivity` startup crash:
- `IllegalStateException: You need to use a Theme.AppCompat theme`.
- Root cause:
- `Theme.AppCompat.DayNight.NoActionBar` was accidentally overridden in app resources
with non-AppCompat parent (`Theme.DeviceDefault.NoActionBar`).
- Fix applied:
- introduced dedicated app theme `Theme.Messenger` with parent `Theme.AppCompat.DayNight.NoActionBar`,
- switched `AndroidManifest.xml` application theme to `@style/Theme.Messenger`.

View File

@@ -13,7 +13,7 @@
android:roundIcon="@android:drawable/sym_def_app_icon" android:roundIcon="@android:drawable/sym_def_app_icon"
android:supportsRtl="true" android:supportsRtl="true"
android:usesCleartextTraffic="true" android:usesCleartextTraffic="true"
android:theme="@style/Theme.AppCompat.DayNight.NoActionBar"> android:theme="@style/Theme.Messenger">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:exported="true"> android:exported="true">

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="Theme.AppCompat.DayNight.NoActionBar" parent="@android:style/Theme.DeviceDefault.NoActionBar" /> <style name="Theme.Messenger" parent="Theme.AppCompat.DayNight.NoActionBar" />
<integer name="google_play_services_version">12451000</integer> <integer name="google_play_services_version">12451000</integer>
</resources> </resources>