包android.support.v4.app不存在;在Android的工作室0.8 [英] package android.support.v4.app does not exist ; in Android studio 0.8

查看:4329
本文介绍了包android.support.v4.app不存在;在Android的工作室0.8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近更新了Android Studio IDE的0.8与新的Andr​​oid L移动SDK的工作。开始我进口的,在旧版本的Andr​​oid工作室收到没有错误完成的Andr​​oid项目。在0.8版我行如

I've recently updated the android studio IDE to 0.8 to work with the new android L SDK. To start I imported a finished android project that receives no errors in the older version of android studio. In version 0.8 i lines such as

进口android.support.v4.app.Fragment;
结果
得到:支持不能​​导致code的其余部分有差错来解决。该logcat的返回101实例

import android.support.v4.app.Fragment;
get: Support cannot be resolved causing the rest of the code to have errors. The logcat returns 101 instances of

Error:(8, 30) error: package android.support.v4.app does not exist

1我每次调用import语句支持库时间。

1 for each time I call the support library in an import statement.

我试过


  • 重新安装IDE

  • 理念文件夹删除内容

  • 重新安装所有SDK的 - 包括支持库

  • 的同步的gradle

  • 手动复制支持库到libs文件夹

  • 重建项目

  • 以及创建一个新的项目,以测试库

不完全知道什么剩下要做的。

not entirely sure what's left to do.

推荐答案

[出于某些原因对Eclipse这个答案是相关的,不是Android的工作室!]

您是否尝试过支持库设置到类路径?这从Android开发者网站链接,对如何做到这一点的一些信息:

Have you tried setting the support libraries to your class path? This link from the Android Developer's website has some info on how to do that:

http://developer.android.com/tool​​s/support-library/ setup.html

尝试以下从网站下列步骤操作:

Try following these steps from the website:

创建基于支持库code库项目:

Create a library project based on the support library code:


  • 确保您已使用SDK管理器下载Android的支持库。

  • 创建库项目,并确保所需的JAR文件都包含在项目的构建路径:

  • 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:


  • 选择文件>导入

  • 选择è xisting的Andr​​oid code进入工作区并单击下一步。

  • 浏览到SDK的安装目录,然后到支持库文件夹。例如,如果您要添加的应用程序兼容性的项目,请浏览/演员/安卓/支持/ V7 /应用程序兼容性/.

  • 单击Finish导入该项目。对于V7应用程序兼容性项目,您现在应该看到标题为新项目的 Android的支持-V7-应用程序兼容性

  • 在新图书馆项目中,展开的库/ 文件夹,右键单击每个.jar文件,并选择构建路径>添加到构建路径。例如,创建了第7版应用程序兼容性项目时,无论是Android的支持 - v4.jar和Android支持-V7-appcompat.jar文件添加到构建路径。

  • 右键单击库项目文件夹,选择构建路径>配置构建路径

  • 订单和出口标签,选中刚刚添加到构建路径的.jar文件,因此它们可用于依赖于该库项目的项目。例如,应用程序兼容性项目要求您导出Android的支持 - v4.jar和Android支持-V7-appcompat.jar这两个文件。

  • 取消选中 Android的依赖关系

  • 单击确定完成更改。

  • 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 /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 the android-support-v4.jar and android-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, the appcompat project requires you to export both the android-support-v4.jar and android-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.


  • 库添加到您的应用程序项目:

  • 项目资源管理器下,右键单击您的项目,并选择属性

  • 在该对话框左侧的类别面板中,选择 Android版

  • 图书馆窗格中,单击添加按钮。

  • 选择库项目,然后单击确定。例如,应用程序兼容性项目应该被列为Android的支持-V7-应用程序兼容性。

  • 在属性窗口中,单击确定。

  • 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.

这篇关于包android.support.v4.app不存在;在Android的工作室0.8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆