![](/img/trans.png)
[英]java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity
[英]external library usage --> java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity
我正在使用支持庫v7 appcompat與ActionBar和片段創建一個應用程序,以便在較舊的Android版本上使用。 到目前為止一切正常。
但是,當我想使用一個庫(在本例中為javassist android)時,我的應用程序在啟動時崩潰。
"java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity"
我的styles.xml看起來像這樣
<style name="AppBaseTheme" parent="Theme.AppCompat.Light"></style>
<style name="AppTheme" parent="AppBaseTheme"></style>
和我的Manifest.xml這樣
<application
android:theme="@style/AppTheme"
... >
...
</application>
該庫沒有任何樣式的定義(我刪除了那些定義)。
就像我寫的一樣,我的應用程序在沒有該Javassist庫的情況下仍然可以工作,但是當我將其添加到構建路徑時會崩潰。
當我不使用appcompat和使用本機ActionBar等時,它也可以工作。 但這對我來說不是解決方案。
我不知道怎么了。 有任何想法嗎?
將主題屬性添加到清單中的活動:
<activity
android:theme="@style/AppTheme"
...>
</activity>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.