android v7支持包导入问题,Support Error的正确解决方法
来源:互联网 发布:docker源码分析 pdf 编辑:程序博客网 时间:2024/05/29 15:15
就是遇到这种报错时该怎么办:
Can’t Find Theme.AppCompat.Light for New Android
ActionBar Support Error retrieving parent for item: No resource found that matches the given name Theme.AppCompat.Light
结论很明确,v7支持包是带资源的库
Adding libraries with resources,文末给出了谷歌官方的解释。
所以你需要的是那几个jar包在各自的地方,并且 project build 和 java build 都配置正确,而不是在纠结mainfest里的版本问题。
首先,你的工程文件应该长下图这个样子,appcompat_v7工程是必须的,在创建时由eclipse在workspace下生成。如果不小心短路删除了,要再创建一个工程,或者有备份可通过File->import ->General->exsiting project 导入
必须注意:appcompat_v7和sdk下的appcompat中的文件夹是不完全一致的,至于为什么,俺也不清楚,有人知道么?
然后,在下图中有四个跟lib有关的地方
—— 1 和 3、4是互补的,4中的jar包会自动build到1中;同时,eclipse会自动识别出不是android SDK私有的jar包,并放入3中。
—— 而 2 中的jar包来自外部的project
这里就要提到 android 工程里的两个 build 配置路径: project build 和 java build
—— project build 里指定好project,然后就能将该工程中的jar包导入到上图的2中
最后,结论很明确,你需要的是那几个jar包在各自的地方,并且 project build 和 java build 都配置正确,而不是在纠结mainfest里的版本问题。
忽略掉httpmine后,就是你们要的正确的样子。然后alt+enter配置吧
楼下是谷歌正统的说法
https://developer.android.com/tools/support-library/setup.html#add-library
什么,你翻不了墙?怪我咯?
Adding libraries with resources
To add a Support Library with resources (such as v7 appcompat for action bar) to your application project:
Using Eclipse
Create a library project based on the support library code:
- Make sure you have downloaded the Android Support Library using the SDK Manager.
- Create a library project and ensure the required JAR files are included in the project’s build path:
- Select File > Import.
- Select Existing Android Code Into Workspace and click Next.
- Browse to the SDK installation directory and then to the Support Library folder. For example, if you are adding the
appcompat
project, browse to<sdk>/extras/android/support/v7/appcompat/
. - Click Finish to import the project. For the v7 appcompat project, you should now see a new project titled android-support-v7-appcompat.
- In the new library project, expand the
libs/
folder, right-click each.jar
file and select Build Path > Add to Build Path. For example, when creating the the v7 appcompat project, add both theandroid-support-v4.jar
andandroid-support-v7-appcompat.jar
files to the build path. - Right-click the library project folder and select Build Path > Configure Build Path.
- In the Order and Export tab, check the
.jar
files you just added to the build path, so they are available to projects that depend on this library project. For example, theappcompat
project requires you to export both theandroid-support-v4.jar
andandroid-support-v7-appcompat.jar
files. - Uncheck Android Dependencies.
- Click OK to complete the changes.
You now have a library project for your selected Support Library that you can use with one or more application projects.
Add the library to your application project:
- In the Project Explorer, right-click your project and select Properties.
- In the category panel on the left side of the dialog, select Android.
- In the Library pane, click the Add button.
- Select the library project and click OK. For example, the
appcompat
project should be listed as android-support-v7-appcompat. - In the properties window, click OK.
Note: If you are using the android-support-v7-mediarouter
support library, you should note that it depends on theandroid-support-v7-appcompat
library. In order for the v7 mediarouter library to compile, you must import both library projects into your development workspace. Then follow the procedure above to add the v7 appcompat project as a library to the v7 mediarouter library project.
来源: http://write.blog.csdn.net/mdeditor#!postId=45824833
- android v7支持包导入问题,Support Error的正确解决方法
- 导入Android-Support-V7包“inconsistent”错误解决方法
- 解决导入android.support.v7的问题
- android-support-v7包问题
- Android项目导入support v7包时遇到的各种问题
- Android Studio如何导入android-support-v4,v7,v13等支持包?
- eclipse中导入v7包 android-support-v7-appcompat 和 android-support-v7-recyclerview
- Android studio 导入V7 支持包
- 导入android-support-v7出错的解决办法
- Android Support v4,v7,v13的区别以及 v4,v7包冲突问题
- android studio如何导入android-support-v7-appcompat包
- android-support-v7包的添加
- 关于android support v7包的使用
- Android Studio 使用Support.v7和support.v4包遇到的各种问题
- Android studio导入依赖包 比如support-v7
- Android学习笔记-eclipse导入support-v7包出错
- 项目中导入ActionBar的android-support-v7-appcompat.jar包
- 关于android.support.v7.widget.RecyclerView包导入项目引发的BUG
- iOS 8 Auto Layout界面自动布局系列4-使用VFL添加布局约束
- dll注入设计
- 【iOS开发-截图】截图并保存相册
- ie9 iframe 中 强制文档 模式
- WindowManager添加的Floating窗口对startActivity的影响问题解决(Android)
- android v7支持包导入问题,Support Error的正确解决方法
- ASP.NET MVC从视图传递多个模型到Controller
- require.js的用法
- install kvm on ubuntu12.04
- AT&T汇编与8086汇编的区别
- 分布式拒绝服务攻击 ---
- 网站优化之保持网站收录量稳定
- solr入门教程
- 分享一些高清javascript书