我剛剛創建Android項目使用(hamburger) drawer與midSDKlevel設置爲android-8。Android 5.0運行時異常與AppCompat導致:java.lang.IllegalStateException:您需要使用Theme.AppCompat主題
,然後在運行Android 5.0模擬器我的RuntimeException
產生的原因:java.lang.IllegalStateException:您需要使用Theme.AppCompat主題(或後裔)與此活動。
\app\src\main\res\values-v21\styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="android:Theme.Material.Light">
</style>
</resources>
Android清單
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MyActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
應該是什麼確切的字符串與程序兼容性材料設計?
檢查主題您的Android清單? – AruLNadhaN 2014-11-24 05:44:25
它有'android:theme =「@ style/AppTheme」' – 2014-11-24 05:59:33