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:

  • Android: pass parameter to Service from Activity
  • How does exactly custom Shadow objects work in Robolectric?
  • onRequestPermissionsResult not being called in dialog fragment
  • Register new mime type in android
  • Unable to initilize OpenGL renderer library
  • When will MeasureSpec.UNSPECIFIED and MeasureSpec.AT_MOST be applied?
  • [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?

    Related posts:

    Dynamically Setting a Fixed Height for a Staggered Grid View
    How to override camera button of Google Glass
    Retrofit-IllegalArgumentException: unexpected url
    Default FirebaseApp is not initialized
    R.Java not generated
    How to make the FAB avoid being moved in ViewPager, yet be a part of the fragment within?
  • How to create custom palette with custom color for Material Design App?
  • Can I use greenrobot EventBus for Communication between Activity and Service?
  • How to get touch feedback from RecyclerView?
  • Is it possible to dither a gradient drawable?
  • Can we use EffectFactory Class for lower versions
  • Screen Video Record of Current Activity Android
  • 7 Solutions collect form web for “After setting up android-support-v7-appcompat R.java is missing”

    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.

    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

    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

    I’m kind of new to Android development, but I found this solution:

    1. If you want compatibility, first make sure you create your project with both the MinimunRequiredSDK, TargetSDK and CompileWith set to API7:Android 2.1(Eclair) at the “New Android Application” Eclipse’s window.

    2. Create the support Library project android-support-v7-appcompat, according to the guide provided by developers.android.com (http://developer.android.com/tools/support-library/setup.html#using-apis)

    3. Add the support library to your project (Right button click on your project, properties, android, at the library frame). Notice that the R.java file is gone.

    4. Go to your project’s project.properties file and change the property called target to “Google Inc.:Google APIs:14”. DO NOT change this attribute in the AndroidManifest.xml file.

    5. Clean your project. The errors are gone.

    6. Run your project.

    7. If you are not running your app on a real device, you’ll always be asked to select a compatible device. Select one that runs Android 2.1 and enjoy.

    OBS.: Due to this workaround, the annoying message “No compatible targets were found” will always appear if you are working with a Virtual Device. You can answer NO and select a device in the Android Device Chooser window. Highly recommended to choose one that runs Android 2.1

    Just click
    Project > Android > Fix Project Properties.

    It worked on Eclipse Kepler and latest ADB version !

    you need to add jar (support v7) in libs folder of support v7 project in your project and add support version 7 as library project to your project

    you should delete the android-support-v4.jar from android private libraries
    because it is already in android-support-v7-appcompat

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.