Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

After setting up android-support-v7-appcompat R.java is missing

I am trying to change my Eclipse project to make it backward compatible to Android 2.1. I followed the instructions to set up the Support Library from here but after I attached the Library project to my project, the R.java from the gen directory gone.

Plus I got some errors in the console, like:

[2013-09-02 00:08:26 - gitarshopAndroidClient] /usr/local/external/android-sdk-linux/extras/android/support/v7/appcompat/res/values-v14/styles_base.xml:24: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ActionBar'.
[2013-09-02 00:08:26 - gitarshopAndroidClient] /usr/local/external/android-sdk-linux/extras/android/support/v7/appcompat/res/values-v14/styles_base.xml:28: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionBar'.
[2013-09-02 00:08:26 - gitarshopAndroidClient] /usr/local/external/android-sdk-linux/extras/android/support/v7/appcompat/res/values-v14/styles_base.xml:32: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ActionBar.Solid'.

Any idea?

like image 663
Remarkable Avatar asked Sep 01 '13 22:09

Remarkable


People also ask

How do I add the v7 Appcompat support library?

In the Properties window, select the "Android" properties group at left and locate the Library properties at right. Select /path/to/appcompat/ and Click Remove. Click Add to open the Project Selection dialog. From the list of available library projects, select v7 appcompat library and click OK.

What are support libraries in Android?

The Android Support Library package is a set of code libraries that provide backward-compatible versions of Android framework APIs as well as features that are only available through the library APIs. Each Support Library is backward-compatible to a specific Android API level.


3 Answers

Okay, I figured out what was the problem.

The build target of my project was Android 2.1 (API 7). I had to target Android 4.0 (API 14) at least to get rid of the warning message.

YOUR APP WILL STILL RUN ON Android 2.1 DEVICES! This is what I missed whan I set up the target wrongly.

like image 53
Remarkable Avatar answered Oct 24 '22 03:10

Remarkable


Click in your project, select properties, select Andoid and do the same with the library to ensure that both have the same Project Build Target. Don't touch tha manifest sdk anything, as that will cause the error to reapear

like image 4
user3017633 Avatar answered Oct 24 '22 04:10

user3017633


What worked for me is to do the following:

  • Right click on the android-support-v7-appcompat project and select Delete (just remove it from the workspace, don't delete from disk).

  • Right click on your project and select Properties -> Android, and remove android-support-v7-appcompat from your references, and click Ok.

  • Clean your project

  • Then select File -> Import and re-import android-support-v7-appcompat.

  • Then go back to Properties -> Android and add the reference again.

  • Clean your project

like image 3
Rob Avatar answered Oct 24 '22 03:10

Rob