JakeWharton / ActionBarSherlock

[DEPRECATED] Action bar implementation which uses the native action bar on Android 4.0+ and a custom implementation on pre-4.0 through a single API and theme.
http://actionbarsherlock.com
Apache License 2.0
7.1k stars 3.53k forks source link

ABS causes an IllegalStateException on some devices #1053

Open Don-Doudou opened 11 years ago

Don-Doudou commented 11 years ago

In some devices that run Android 2.1+ i have this exception:

java.lang.RuntimeException: Unable to start activity java.lang.IllegalStateException: You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1816) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1837) at android.app.ActivityThread.access$1500(ActivityThread.java:132) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1033) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:143) at android.app.ActivityThread.main(ActivityThread.java:4196) 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:839) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.IllegalStateException: You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative. at com.actionbarsherlock.internal.ActionBarSherlockCompat.generateLayout(ActionBarSherlockCompat.java:976) at com.actionbarsherlock.internal.ActionBarSherlockCompat.installDecor(ActionBarSherlockCompat.java:902) at com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:836) at com.actionbarsherlock.app.SherlockActivity.setContentView(SherlockActivity.java:229) at com.don.app.constitutionduniger.MainActivity.onCreate(MainActivity.java:31) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1780) ... 11 more

hameno commented 10 years ago

Well, you did read the error message, right? :) The parent style seems to be wrong (maybe in one of the configurations?)

alexliubj commented 10 years ago

It always crash when I open the music balance settings page.

2013/10/23 Philip Schiffer notifications@github.com

Well, you did read the error message, right? :) The parent style seems to be wrong (maybe in one of the configurations?)

— Reply to this email directly or view it on GitHubhttps://github.com/JakeWharton/ActionBarSherlock/issues/1053#issuecomment-26881960 .

Alex.Liu

thuannv commented 10 years ago

When you use actionbarsherlock, in your AndroidManifest.xml you should be specify theme which is inherit from sherlock theme. ex: <activity android:name="com.vng.labansecurity.SettingsActivity" android:label="@string/settings" android:theme="@style/Theme.Sherlock" >

voydz commented 10 years ago

Reference to #966 ?

antoni-alvarez commented 10 years ago

Im using "Theme.Sherlock" style, and I have this exact error in my Developer Console. This is my Manifest:

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/Theme.Sherlock" >
thuannv commented 10 years ago

You should specify theme inherits from Theme.Sherlock in your activity instead of your application, as my AndroidManifest.xml below:

    <activity
        android:name="com.vng.labansecurity.MainActivity"
        android:configChanges="screenSize"
        android:label="@string/app_name"
        android:launchMode="singleTask"
        android:theme="@style/Theme.Sherlock"
        android:uiOptions="splitActionBarWhenNarrow" >
        <meta-data
            android:name="android.support.UI_OPTIONS"
            android:value="splitActionBarWhenNarrow" />

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
sogrEEN commented 10 years ago

2013/12/16 Thuan Nguyen notifications@github.com

You should specify theme inherits from Theme.Sherlock in your activity instead of your application, as my AndroidManifest.xml below:

<activity
    android:name="com.vng.labansecurity.MainActivity"
    android:configChanges="screenSize"
    android:label="@string/app_name"
    android:launchMode="singleTask"
    android:theme="@style/Theme.Sherlock"
    android:uiOptions="splitActionBarWhenNarrow" >
    <meta-data
        android:name="android.support.UI_OPTIONS"
        android:value="splitActionBarWhenNarrow" />

    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

¡ª Reply to this email directly or view it on GitHubhttps://github.com/JakeWharton/ActionBarSherlock/issues/1053#issuecomment-30628756 .

Oh£¡£¡I Know......thank you for your help£¡£¡