包 android.support.v4.app 不存在;在安卓工作室 0.8

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

问题描述

我最近将 android studio IDE 更新到 0.8 以使用新的 android L SDK.首先,我导入了一个完成的 android 项目,该项目在旧版本的 android studio 中没有收到任何错误.在 0.8 版 i 行如

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;
获取:无法解决支持,导致其余代码出现错误.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.

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

我试过了

  • 重新安装 IDE
  • 删除idea文件夹的内容
  • 正在安装所有 SDK - 包括支持库
  • 同步 gradle
  • 手动将支持库复制到 libs 文件夹中
  • 重建项目
  • 以及创建一个新项目来测试库

不完全确定还需要做什么.

not entirely sure what's left to do.

推荐答案

[由于某些原因,此答案与 Eclipse 相关,而不是 Android Studio!]

您是否尝试过将支持库设置为您的类路径?这个链接来自 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.

尝试从网站上执行以下步骤:

Try following these steps from the website:

根据支持库代码创建库项目:

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:

  • 选择文件>导入.
  • 选择 Eexisting Android Code Into Workspace 并点击下一步.
  • 浏览至 SDK 安装目录,然后浏览至 Support Library 文件夹.例如,如果您要添加 appcompat 项目,请浏览到/extras/android/support/v7/appcompat/.
  • 单击完成"导入项目.对于 v7 appcompat 项目,您现在应该会看到一个名为 android-support-v7-appcompat 的新项目.
  • 在新的库项目中,展开 libs/ 文件夹,右键单击每个 .jar 文件并选择 Build Path > Add to Build Path.例如,在创建 v7 appcompat 项目时,将 android-support-v4.jar 和 android-support-v7-appcompat.jar 文件都添加到构建路径中.
  • 右键单击库项目文件夹并选择构建路径>配置构建路径.
  • Order and Export 选项卡中,检查您刚刚添加到构建路径的 .jar 文件,以便它们可用于依赖此库项目的项目.例如,appcompat 项目要求您同时导出 android-support-v4.jar 和 android-support-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.

  • 将库添加到您的应用程序项目中:
  • Project Explorer 中,右键单击您的项目并选择 Properties.
  • 在对话框左侧的类别面板中,选择Android.
  • 窗格中,点击添加按钮.
  • 选择库项目并单击确定".例如,appcompat 项目应列为 android-support-v7-appcompat.
  • 在属性窗口中,单击确定".
  • 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 不存在;在安卓工作室 0.8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How can create a producer using Spring Cloud Kafka Stream 3.1(如何使用Spring Cloud Kafka Stream 3.1创建制片人)
Insert a position in a linked list Java(在链接列表中插入位置Java)
Did I write this constructor properly?(我是否正确地编写了这个构造函数?)
Head value set to null but tail value still gets displayed(Head值设置为空,但仍显示Tail值)
printing nodes from a singly-linked list(打印单链接列表中的节点)
Control namespace prefixes in web services?(控制Web服务中的命名空间前缀?)