eclipse 导入Android平台类的问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12785607/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Problems with importing Android platform classes
提问by sncrmck
I'm new to Android. It seems there have been way too many problems just getting eclipse and the SDK setup with everything just where it should be. I've been working on an example from the Android Developer website, but it's throwing an error saying:
我是安卓新手。似乎有太多的问题只是让 Eclipse 和 SDK 设置在它应该在的地方。我一直在研究 Android Developer 网站上的一个例子,但它抛出了一个错误,说:
The import android.support cannot be resolved
导入android.support无法解决
I'm trying to import the following:
我正在尝试导入以下内容:
import android.support.v4.app.NavUtils;
I have three of the newest SDK platform versions installed and also have the rev.10 support library installed. Is the android.jar file pointing to the wrong folder? I found the folder/files that I'm trying to import but I'm wondering if they're in the right place.
我安装了三个最新的 SDK 平台版本,还安装了 rev.10 支持库。android.jar 文件是否指向错误的文件夹?我找到了要导入的文件夹/文件,但我想知道它们是否在正确的位置。
C:\Program Files (x86)\Android\android-sdk\sources\android-16\android\support
C:\Program Files (x86)\Android\android-sdk\sources\android-16\android\support
I haven't moved anything since I installed everything, so I'm confused why most everything else will import but the support classes are missing. Thanks in advance for the help.
自从我安装了所有东西后,我没有移动任何东西,所以我很困惑为什么大多数其他东西都会导入但缺少支持类。在此先感谢您的帮助。
回答by CommonsWare
but it's throwing me an error saying "The import android.support cannot be resolved"
但它给我一个错误提示“无法解析导入 android.support”
Everything in the android.support.*
series of packages comes from the Android Support package (what I think you are calling "rev. 10 support library".
该android.support.*
系列软件包中的所有内容均来自 Android 支持软件包(我认为您称之为“rev. 10 支持库”。
I have three of the newest SDK platform versions installed and have rev.10 support library installed
我安装了三个最新的 SDK 平台版本并安装了 rev.10 支持库
The Android Support package does not only need to be downloaded to your development machine, but it also needs to be added to your project. If you are using Eclipse, right-click over your project in the Package Explorer and choose Android Tools > Add Support Library to add it to your project. If you are not using Eclipse, find the android-support-v4.jar
file in your SDK installation and copy that to your project's libs/
directory.
Android 支持包不仅需要下载到您的开发机器上,还需要添加到您的项目中。如果您使用的是 Eclipse,请在 Package Explorer 中右键单击您的项目,然后选择 Android Tools > Add Support Library 将其添加到您的项目中。如果您没有使用 Eclipse,请android-support-v4.jar
在您的 SDK 安装中找到该文件并将其复制到您的项目libs/
目录中。