Android工程导入时常见的错误解决方法

来源:互联网 发布:select ajax json 联动 编辑:程序博客网 时间:2024/04/30 06:42

    在导入一个Android工程后,一般会遇到以下错误:

    1. Unable to resolve target 'android-xx'

    解决方法:

           右键点击项目名称->“刷新”,之后关闭工程,再次打开。

    2. 再次打开后,出现:

        error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.    (res/values/style.xml中)

        error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.    (res/values-v11/style.xml中)

        error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.    (res/values/style.xml中)

    解决方法:

          1)导入android库。"File"->"Import"->"Import"对话框中选择"Android"->"Existing Android Code Into Workspace"->"next"->"Browse"选择Android SDK的路径(笔者的路径为:F:\工作9\工具\android-sdk\adt-bundle-windows-x86_64-20130917\sdk\extras\android\support\v7\appcompat)->勾选"Copy projects into workspace"复选框->"Finish";

          2)右键点击项目名称->"Properties"->"Properties For xxx"对话框左侧选择"Android",右侧"Library"中点击"ADD"按钮,添加之前导入到工程中的库(执行上一步后这一步会自动找到刚才导入的库);

          3)接上一步,对话框左侧选择"Java Build Path",右侧选择"Libraries"选项卡,点击"Add JARs..."按钮,选择导入的android中的library,点击"OK"按钮,回到"->"Properties For xxx"对话框,再次点击"OK"按钮。

          4)此时问题应该得以解决。如果还未解决,点击"保存全部"按钮,之后刷新一下项目。

 

0 0
原创粉丝点击