0

I am getting a RuntimeException on Android 2.3.5 but I am using Theme.AppCompat (res/values/themes.xml). This is the phone: https://onezdevice.com/motorola-razr-40-ultra

<!-- res/values/themes.xml -->
<style name="Theme.Styled" parent="@style/Theme.AppCompat">
     <item name="actionBarStyle">@style/QueryActionBar</item>
     <item name="android:actionBarStyle">@style/QueryActionBar</item>
 </style>

 <style name="QueryActionBar" parent="@style/Widget.AppCompat.ActionBar">
     <item name="background">@color/blueback</item>
     <item name="android:background">@color/blueback</item>
     <item name="backgroundSplit">@color/blueback</item>
     <item name="android:backgroundSplit">@color/blueback</item>
 </style>
</resources>

Here is the file for values-v11.

<!-- res/values-v11/themes.xml -->
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
    <style name="QueryTheme" parent="@android:style/Theme.Holo">
    <!-- Any customizations for your app running on devices with Theme.Holo here -->
    </style>
 </resources>

Here is the error.

 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
 at android.app.ActivityThread.access$1500(ActivityThread.java:117)
 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
 at android.os.Handler.dispatchMessage(Handler.java:99)
 at android.os.Looper.loop(Looper.java:130)
 at android.app.ActivityThread.main(ActivityThread.java:3687)
 at java.lang.reflect.Method.invokeNative(Native Method)
 at java.lang.reflect.Method.invoke(Method.java:507)
 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
 at dalvik.system.NativeStart.main(Native Method)
 Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
 at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:102)
 at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)
 at com.txt2lrn.www.LandingActivity.onCreate(LandingActivity.java:95)
 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
 ... 11 more

Sorry folks, I also do have android:theme="@style/Theme.Styled" defined in AndroidManifest.xml.
  • 1
    Does this answer your question? [ActionBarCompat: java.lang.IllegalStateException: You need to use a Theme.AppCompat](https://stackoverflow.com/questions/18063395/actionbarcompat-java-lang-illegalstateexception-you-need-to-use-a-theme-appcom) It seems like you literally copied this question from the linked duplicate question. – karel Jun 02 '23 at 09:22

0 Answers0