java.lang.IllegalStateException:您需要使用Theme.AppCompat主题(或后代)与本次活动 [英] java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity
问题描述
我试图运行我的Android应用程序时收到此错误。
但奇怪的事情:它仅在Android应用程序建(并签名)与詹金斯发生。
在我使用本地apk文件从Eclipse和它推到我的设备(或模拟器),一切工作正常。
任何想法?
编辑: AndroidManifest.xml中
<应用
机器人:名称=at.my.test.App
机器人:allowBackup =真
机器人:图标=@可绘制/ ic_launcher
机器人:标签=@字符串/ APP_NAME
机器人:主题=@风格/ MyActionBarTheme>
<活动
机器人:名称=SplashActivity
机器人:标签=@字符串/ APP_NAME
机器人:screenOrientation =画像
机器人:主题=@安卓风格/ Theme.Black.NoTitleBar>
<意向滤光器>
<作用机器人:名称=android.intent.action.MAIN/>
<类机器人:名称=android.intent.category.LAUNCHER/>
&所述; /意图滤光器>
< /活性GT;
<活动
机器人:名称=LoginActivity
机器人:screenOrientation =画像
机器人:windowSoftInputMode =stateHidden>
< /活性GT;
<活动
机器人:名称=MyFirstActivity
机器人:screenOrientation =画像>
< /活性GT;
<活动
机器人:名称=MySecondActivity
机器人:screenOrientation =画像>
< /活性GT;
<活动
机器人:名称=MyThirdActivity
机器人:screenOrientation =画像>
< /活性GT;
<活动
机器人:名称=WebActivity
机器人:screenOrientation =画像>
< /活性GT;
<活动
机器人:名称=ErrorActivity
机器人:screenOrientation =画像
机器人:主题=@安卓风格/ Theme.Black.NoTitleBar>
< /活性GT;
< /用途>
和中的themes.xml文件:
<样式名称=MyActionBarTheme父=@风格/ Theme.AppCompat>
<项目名称=机器人:actionBarStyle> @风格/ MyActionBar< /项目>
<项目名称=机器人:homeAsUpIndicator> @可绘制/ ic_up_arrow< /项目>
<项目名称=机器人:windowActionBar>真< /项目>
<项目名称=机器人:windowBackground> @android:彩色/白< /项目>
<项目名称=机器人:windowContentOverlay> @空< /项目>
<! - 支持库的兼容性 - >
<项目名称=actionBarStyle> @风格/ MyActionBar< /项目>
<项目名称=homeAsUpIndicator> @可绘制/ ic_up_arrow< /项目>
< /风格>
<! - 动作条的风格 - >
<样式名称=MyActionBar父=@风格/ Widget.AppCompat.ActionBar>
<项目名称=机器人:背景> @色/ my_highlight< /项目>
<! - 支持库的兼容性 - >
<项目名称=背景> @色/ my_highlight< /项目>
< /风格>
也许这将帮助你解决你的问题。 (我不熟悉詹金斯。)请把这个属性的活动(您使用的动作条/抽屉)的清单
安卓主题=@风格/ Theme.AppCompat
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>
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"
这篇关于java.lang.IllegalStateException:您需要使用Theme.AppCompat主题(或后代)与本次活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!