Fixing Error in styles.xml to generate R.java : No resource found name 'Theme.AppCompat.Light'

耗尽温柔 提交于 2019-11-27 08:28:48

You are trying to use Theme.AppCompat.Light theme which is a library project. You have to reference this library project to your project.

Now, at first, check that you have installed this library project as follows...

Go Window-->Android SDK Manager then a window named Android SDK Manager will appear as below.

If the Android Support Library is not installed then install it. You can see more information about Android Support Library setup from the below Android Developer site.

Support Library Setup

After Android Support Library setup completion, reference the library to your project from this path...

android-sdk/extras/android/support/v7/appcompat

To reference, follow these steps:

  1. File->Import (android-sdk\extras\android\support\v7). Choose "appcompat"
  2. Project-> properties->Android. In the section library "Add" and choose "appCompat"

Now, clean and build your project and run it. I think after all of these, your problem will be solved.

skm9

I finally figured out the problem. I had to delete this line of code from my main.xml:

android:showAsAction="never"

Under my values-v11 and values-14 folders I changed the name of the app to...

style name="AppBaseTheme" parent="android:Theme.Light"

...and it is currently working.

Since you're using Theme.AppCompat.Light in your Theme, you have to include appCompat into your Project.

  • File->Import (android-sdk\extras\android\support\v7). Choose "appcompat"

  • Project-> properties->Android. In the section library

  • "Add" and choose "appCompat"

That should work.

Make sure you closed the <resources> tag properly and add at the bottom of your styles.xml:

 </resources>

according to your posted code snippet that is not present, but needs to be

Edit: the missing resources tag was just a copy-paste bug in question, so here that was not the reason.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!