user2384694 user2384694 - 1 year ago 68
Android Question

why error only in 4.3 but works for 5.x/6.x IllegalStateException: You need to use a Theme.AppCompat 4.3

I found following SO questions on the same topic

You need to use a Theme.AppCompat theme (or descendant) with this activity

My question is more about why it only happened on device with Android 4.3. Same code works with Android 5/6

public class MyActivity extends AppCompatActivity {


<!-- Base application theme. -->
<style name="AppTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:windowBackground">@null</item>
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/background_splash</item>


<?xml version="1.0" encoding="utf-8"?>
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">

Can you please explain?

Answer Source

I believe the answer is in your code. styles.xml is used on devices with Android 4.3, and v21/styles.xml on device with Android 5+ Try to remove v21/styles.xml and see what happen on Android 5+.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download