After updating the Android SDK to version 5.0, the getActionBar () method started to return null, which caused my application to crash on startup. I do not know what caused this, and any existing Stackoverflow threads did not help.
Here is my manifest:
<application android:name="App" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/ActionBarTheme" >
styles.xml:
<style name="AppBaseTheme" parent="Theme.AppCompat.Light"></style> <style name="AppTheme" parent="AppBaseTheme"></style> <style name="ListItemPadding"> <item name="android:paddingTop">8dp</item> <item name="android:paddingRight">5dp</item> <item name="android:paddingBottom">8dp</item> <item name="android:paddingLeft">5dp</item> </style>
themes.xml:
<?xml version="1.0" encoding="utf-8"?> <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="ActionBarTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar"> <item name="android:actionBarStyle">@style/ActionBar</item> <item name="android:actionOverflowButtonStyle">@style/OverflowButton</item> <item name="actionBarStyle">@style/ActionBar</item> <item name="actionOverflowButtonStyle">@style/OverflowButton</item> </style> <style name="OverflowButton" parent="android:style/Widget.Holo.ActionButton.Overflow"> <item name="android:src">@drawable/menu</item> </style> <style name="ActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse"> <item name="android:background">@color/main</item> <item name="background">@color/main</item> </style> </resources>
and my gradle dependencies:
dependencies { compile 'com.github.jenzz.undobar:library:1.1: api8Release@aar ' compile 'com.android.support:support-v4:21.0.0' compile 'com.android.support:appcompat-v7:21.0.0' compile 'com.loopj.android:android-async-http:1.4.5' compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3' compile 'com.google.android.gms:play-services:6.1.+' }
Any help is much appreciated!
source share