error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.

时间:2022-05-30 23:33:27

error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.

error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.

这个错误表明缺少Theme.AppCompat.Light这个主题,而这个主题在appcompat-v7里面,所以要解决这个问题,先下载一个appcompat-v7库,再import。

error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.

import以后,再把该库添加到出错的工程中。步骤:

(1)右键单击项目,选择Properties,在左边的窗体中选择Android;

(2)点击Library列表旁边的Add按钮,在弹出的窗体中双击appcompat-v7;

error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.

error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.

(3)点击OK,已将appcompat-v7添加到工程,就不会再有这个错误了。