Java Eclipse ADT appcompat...是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22204659/
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
Eclipse ADT appcompat... what is it?
提问by Omar.Ebrahim
I've spent all afternoon getting absolutely nowhere with this. I've downloaded Eclipse, downloaded the SDK, installed the updates, but every new Android project I create something's wrong.
我整个下午都没有解决这个问题。我已经下载了 Eclipse,下载了 SDK,安装了更新,但是我创建的每个新 Android 项目都有问题。
Firstly, it would not generate the R.java file, at all, now it does but there's a separate project it's created automatically called appcompat_v7. I don't know what this is, but it's causing problems with any other new project.
首先,它根本不会生成 R.java 文件,现在它会生成,但它会自动创建一个名为 appcompat_v7 的单独项目。我不知道这是什么,但它会导致任何其他新项目出现问题。
This is the error a normal project produces: The container 'Android Dependencies' references non existing library '/home/omar/workspace/appcompat_v7/bin/appcompat_v7.jar'
这是正常项目产生的错误:容器“Android 依赖项”引用非现有库“/home/omar/workspace/appcompat_v7/bin/appcompat_v7.jar”
I have absolutely no idea how to fix this. What is causing this?
我完全不知道如何解决这个问题。这是什么原因造成的?
EDIT It appear this is only with KitKat, every other API platform doesn't produce ANY source files at all.... any idea how to combat this?
编辑看来这仅适用于 KitKat,其他所有 API 平台根本不生成任何源文件......知道如何解决这个问题吗?
采纳答案by NickT
It's a support library which presumably your project refers to. You will need to build it as a library project in your workspace. This process is described here Support Library Setupunder Adding libraries with resources.
它是一个支持库,大概是您的项目所指的。您需要将其构建为工作区中的库项目。此过程在“使用资源添加库”下的“支持库设置”中进行了描述。
You will find the project you need to copy in your SDK in the folder:
你会在你的SDK中的文件夹中找到你需要复制的项目:
\yourSDKlocation\tools\android-sdk-windows4.4\extras\android\support\v7\appcompat
\yourSDKlocation\tools\android-sdk-windows4.4\extras\android\support\v7\appcompat
(It's no use just copying a jar, you must build it as a library project.)
(仅仅复制一个jar是没有用的,你必须将它构建为一个库项目。)
回答by JanB
I had this problem when I moved a project to a different laptop. I solved it like this:
当我将一个项目移动到另一台笔记本电脑时,我遇到了这个问题。我是这样解决的:
If appcompat_v7 is not available in Eclipse: From the File menu, choose New then Project. Next, choose Android and Android Project from existing Code, then click next Browse to find your appcompat_v7 project folder Make sure there's a check mark next it in the ‘Projects to Import' list If the appcompat_v7 project folder is not currently in your workspace, select ‘Copy projects into workspace', then click Finish
如果 Eclipse 中没有 appcompat_v7:从文件菜单中,选择新建,然后选择项目。接下来,从现有代码中选择 Android 和 Android 项目,然后单击下一步浏览以找到您的 appcompat_v7 项目文件夹 确保在“要导入的项目”列表中旁边有一个复选标记 如果 appcompat_v7 项目文件夹当前不在您的工作区中,请选择'将项目复制到工作区',然后单击完成
Now that the library project is available in your workspace, it can be added to a project: Choose your project from the Project Explorer and open the project properties (on a mac it's in the Project menu) Click on Android in the left list Next to the Library list, click the Add button Choose appcompat_v7 from the list
现在库项目在您的工作区中可用,可以将其添加到项目中:从项目资源管理器中选择您的项目并打开项目属性(在 Mac 上,它位于项目菜单中)单击左侧列表中的 Android 旁边的在库列表中,单击添加按钮 从列表中选择 appcompat_v7
You should be good to go now.
你现在应该可以走了。