user3231849
user3231849

Reputation: 31

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

I'm getting this error when trying to run my android application.

The strange thing: It only happens when the android application was built (and signed) with Jenkins.

When I use the local apk file from eclipse and push it to my device (or emulator), everything works fine

Any ideas?

Edit: AndroidManifest.xml

<application
    android:name="at.my.test.App"
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/MyActionBarTheme" >
    <activity
        android:name="SplashActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.Black.NoTitleBar" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="LoginActivity"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="stateHidden" >
    </activity>
    <activity
        android:name="MyFirstActivity"
        android:screenOrientation="portrait" >
    </activity>
    <activity
        android:name="MySecondActivity"
        android:screenOrientation="portrait" >
    </activity>
    <activity
        android:name="MyThirdActivity"
        android:screenOrientation="portrait" >
    </activity>
    <activity
        android:name="WebActivity"
        android:screenOrientation="portrait" >
    </activity>
    <activity
        android:name="ErrorActivity"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.Black.NoTitleBar" >
    </activity>
</application>  

And the themes.xml file:

<style name="MyActionBarTheme" parent="@style/Theme.AppCompat">

    <item name="android:actionBarStyle">@style/MyActionBar</item>
    <item name="android:homeAsUpIndicator">@drawable/ic_up_arrow</item>
    <item name="android:windowActionBar">true</item>
    <item name="android:windowBackground">@android:color/white</item>
    <item name="android:windowContentOverlay">@null</item>

    <!-- Support library compatibility -->
    <item name="actionBarStyle">@style/MyActionBar</item>
    <item name="homeAsUpIndicator">@drawable/ic_up_arrow</item>

</style>

<!-- ActionBar styles -->
<style name="MyActionBar" parent="@style/Widget.AppCompat.ActionBar">

    <item name="android:background">@color/my_highlight</item>

    <!-- Support library compatibility -->
    <item name="background">@color/my_highlight</item>

</style>

Upvotes: 3

Views: 14436

Answers (3)

Mahendran Candy
Mahendran Candy

Reputation: 1144

This is happen only for missing styles from values-21,values-18 missing in resource folder in android project or you are not used to declared the correct theme in Manifest in appropriate project.

Upvotes: 0

ASP
ASP

Reputation: 1974

May this will help you to solve your problem. (I haven't familiar with Jenkins.) Please put this attribute to Activity (in which you used the Actionbar/Drawer) in Manifest

android:theme="@style/Theme.AppCompat"

Upvotes: 10

saneryee
saneryee

Reputation: 3405

styles.xml

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
</style>

Upvotes: 2

Related Questions