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

后端 未结 7 2186
长情又很酷
长情又很酷 2020-12-05 20:43

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 atta

7条回答
  •  死守一世寂寞
    2020-12-05 21:22

    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

提交回复
热议问题