Android工程导入时常见的错误解决方法
2015-10-26 10:06
585 查看
在导入一个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)此时问题应该得以解决。如果还未解决,点击"保存全部"按钮,之后刷新一下项目。
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)此时问题应该得以解决。如果还未解决,点击"保存全部"按钮,之后刷新一下项目。
相关文章推荐
- Android 视频播放的三种方法
- Android教程 -07 Activity的任务栈和启动模式
- Android教程 -07 Activity的任务栈和启动模式
- java/android中获取当前日期的方法
- android的widget讲解
- 日常杂存
- 自定义动画&动画总结
- android中三种onClick事件的实现
- Android 主题及自定义窗口
- Android中内容观察者的使用---- ContentObserver类详解
- android横竖屏切换
- android 用 XML 自定义边框(只上下边框有色)
- Android开发技巧-Fragment的懒加载
- 安卓开发学习之005 LinearLayout之Weight/measureWithLargestChild详解
- android android.view.InflateException: Binary XML file line #14: Error inflating class<unknown>
- android在Service,BroadCast onReceiver()中弹出Dialog对话框
- Android_10_Java调用C代码(纯手工制作)
- Android创建项目时候为什么是RelativeLayout
- Android studio 中的Theme Editor神器
- Android 4.0新组件:GridLayout详细说明