android v7支持包导入问题,Support Error的正确解决方法
2015-05-18 18:11
429 查看
就是遇到这种报错时该怎么办:
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
什么,你翻不了墙?怪我咯?
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
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
Right-click the library project folder and select Build Path > Configure Build Path.
In the Order and Export tab, check the
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
In the properties window, click OK.
Note: If you are using the
https://developer.android.com/tools/support-library/setup.html#add-library> 转载请注明。
来源: http://write.blog.csdn.net/mdeditor#!postId=45824833
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
appcompatproject, 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
.jarfile and select Build Path > Add to Build Path. For example, when creating the the v7 appcompat project, add both the
android-support-v4.jarand
android-support-v7-appcompat.jarfiles 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
.jarfiles you just added to the build path, so they are available to projects that depend on this library project. For example, the
appcompatproject requires you to export both the
android-support-v4.jarand
android-support-v7-appcompat.jarfiles.
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
appcompatproject should be listed as android-support-v7-appcompat.
In the properties window, click OK.
Note: If you are using the
android-support-v7-mediaroutersupport library, you should note that it depends on the
android-support-v7-appcompatlibrary. 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.
https://developer.android.com/tools/support-library/setup.html#add-library> 转载请注明。
来源: http://write.blog.csdn.net/mdeditor#!postId=45824833
相关文章推荐
- [一般问题] android导入项目中遇到的一些问题及解决方法
- 关于导入的JS不支持中文的问题解决方法
- 解决将excel数据导入sqlserver后数字格式不正确的问题的方法
- android学习—— Android导入源代码出现Remove @Override问题解决方法
- Eclipse导入Android项目的正确方法及出错后的解决办法
- Eclipse中导入android项目名前有红叉但项目内文件无错误问题解决方法
- 【Android问题】Android导入一个工程时提示 Invalid project description的解决方法
- android学习—— Android导入源代码出现Remove @Override问题解决方法 .
- 关于Android开发导入已有项目遇到Project has no default.properties file! Edit the project properties to set one.问题的解决方法
- Eclipse中导入android项目名前有红叉但项目内文件无错误问题解决方法
- Android Studio设置主题 和 不支持中文的问题解决方法
- Android Studio设置主题和不支持中文的问题解决方法
- android项目导入到eclipse中去出现 Case Variant exsits问题的部分解决方法尝试
- Eclipse中导入android项目名前有红叉但项目内文件无错误问题解决方法
- Eclipse中导入android项目名前有红叉但项目内文件无错误问题解决方法
- Android ScrollView里嵌套Listview,造成Listview的Item显示1行问题的最正确的解决方法
- 导入Android工程源码出现乱码问题的解决方法
- Android添加新版本支持包V7后自定义ActionBar左侧有空白,不能完全填充问题解决
- 导入Actionbarssherlock 和appcompat_v7 冲突的问题以及解决方法
- Android添加新版本支持包V7后自定义ActionBar左侧有空白,不能玩全填充问题解决