I was following one SIMPLE tutorial of Sherlock Action Bar. I followed each and every step. The problem is I'm getting error on versions 2.1 to 2.3 and working fine on 4.0 to 4.1.
I'm using Android SDK tools 20.0.3 And Eclipse version 4.2.0
setContentView(R.layout.activity_main);
In above code it says R cannot be resolved to a variable
.
and some more errors are as follows:
[2012-09-04 22:18:21 - Action Bar demo] C:\Users\Karthick\Desktop\Project libs\JakeWharton-ActionBarSherlock-88fc341\library\res\values-v14\abs__styles.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ActionBar'.
[2012-09-04 22:18:21 - Action Bar demo] C:\Users\Karthick\Desktop\Project libs\JakeWharton-ActionBarSherlock-88fc341\library\res\values-v14\abs__styles.xml:6: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ActionBar.Solid'.
[2012-09-04 22:18:21 - Action Bar demo] C:\Users\Karthick\Desktop\Project libs\JakeWharton-ActionBarSherlock-88fc341\library\res\values-v14\abs__styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionBar'.
[2012-09-04 22:18:21 - Action Bar demo] C:\Users\Karthick\Desktop\Project libs\JakeWharton-ActionBarSherlock-88fc341\library\res\values-v14\abs__styles.xml:10: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionBar.Solid'.
For better understanding, here are some images:
My manifest file is:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.action.bar"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.Sherlock" >
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Google"></activity>
</application>
Somebody assist me in fixing these errors in Android 2.3
The same code is working fine in Android 4.0.3
The problem is I'm getting error on versions 2.1 to 2.3 and working fine on 4.0 to 4.1.
=> As you have mentioned this is working fine in 4.0 and 4.1 but not in 2.x version, i am sure you forgot include compatible ActionBarSherlock theme in your style.xml:
If you haven't included styles.xml with below values, then do it:
<style name="AppTheme" parent="Theme.Sherlock.Light.DarkActionBar"/>
As you have mentioned above about values-v11 and values-v14 for styles.xml, you can create styles.xml in both the folder with below values:
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With