eclipse 新建Android项目创建失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27138139/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 22:14:53  来源:igfitidea点击:

New Android project fails to create successfully

androideclipseadteclipse-adt

提问by RenegadeAndy

I want to create an android project in eclipse. Seems simple enough. I downloaded and installed:

我想在 Eclipse 中创建一个 android 项目。看起来很简单。我下载并安装了:

eclipse version:

日食版本:

Version: Luna Service Release 1 (4.4.1)
Build id: 20140925-1800

ADT version latest from:

ADT 版本最新来自:

https://dl-ssl.google.com/android/eclipse/

On windows 64 bit.

在 Windows 64 位上。

When I create a new project I follow the wizard with the following settings:

当我创建一个新项目时,我会按照向导进行以下设置:

Application Name: DemoProject Project Name: DemoProject Package Name:com.example.demoproject Min SDK: API8 Target: API21 Compile with API21 Theme: Holo light with dark action bar

应用程序名称:DemoProject 项目名称:DemoProject 包名称:com.example.demoproject 最小 SDK:API8 目标:API21 编译 API21 主题:Holo light with dark action bar

Create customer launcher icon, create activity, create project in the workspace

在工作区中创建客户启动器图标、创建活动、创建项目

Icon is text, ImF,full padding and circle option.

图标是文本、ImF、全填充和圆形选项。

I then choose Blank Activity and leave defaults on the next page. I then press finish. The wizard page remains open and the following appear in the console view:

然后我选择空白活动并在下一页保留默认值。然后我按完成。向导页面保持打开状态,控制台视图中显示以下内容:

[2014-11-25 22:39:15 - DemoProject] C:\Users\Andy\workspace\DemoProject\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2014-11-25 22:39:15 - DemoProject] 
[2014-11-25 22:39:15 - DemoProject] C:\Users\Andy\workspace\DemoProject\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2014-11-25 22:39:15 - DemoProject] 
[2014-11-25 22:39:15 - DemoProject] C:\Users\Andy\workspace\DemoProject\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
[2014-11-25 22:39:15 - DemoProject] 
[2014-11-25 22:39:16 - DemoProject] C:\Users\Andy\workspace\DemoProject\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2014-11-25 22:39:16 - DemoProject] 
[2014-11-25 22:39:16 - DemoProject] C:\Users\Andy\workspace\DemoProject\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2014-11-25 22:39:16 - DemoProject] 
[2014-11-25 22:39:16 - DemoProject] C:\Users\Andy\workspace\DemoProject\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
[2014-11-25 22:39:16 - DemoProject] 
[2014-11-25 22:39:21 - DemoProject] C:\Users\Andy\workspace\DemoProject\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2014-11-25 22:39:21 - DemoProject] 
[2014-11-25 22:39:21 - DemoProject] C:\Users\Andy\workspace\DemoProject\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2014-11-25 22:39:21 - DemoProject] 
[2014-11-25 22:39:21 - DemoProject] C:\Users\Andy\workspace\DemoProject\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
[2014-11-25 22:39:21 - DemoProject] 

Really not sure what the next step is!?

真的不知道下一步是什么!?

采纳答案by mattd

Go to Android SDK Manager and download Android Support Library like explained here: No resource found that matches the given name '@style/Theme.AppCompat.Light'.

转到 Android SDK 管理器并下载 Android 支持库,如此处所述:找不到与给定名称匹配的资源 '@style/Theme.AppCompat.Light'

Since you want to support Api from level 8, and from that themes changes a lot, you need some libraries to do "retro compatibility".. Also pay attention when you code, to manage different versions and to import correct package.

既然你想从 8 级开始支持 Api,而且主题变化很大,你需要一些库来做“复古兼容”.. 编码时也要注意,管理不同的版本并导入正确的包。

回答by mobilepotato7

Add the app-compat-v7 library to your project. You can download it from your SDK Manager. Look for Support libraries.

将 app-compat-v7 库添加到您的项目中。您可以从 SDK 管理器下载它。寻找支持库。

回答by Mike Duong

I have the same problem like you and I found the way to fix it. I'm sure that you didn't install Android Support Library in SDK Manager. (You can't see the Appcompat_v7 appear when you try to create a project.)

我和你有同样的问题,我找到了解决它的方法。我确定您没有在 SDK 管理器中安装 Android 支持库。(当您尝试创建项目时,您看不到 Appcompat_v7 出现。)

How to install that?

如何安装?

Open SDK Manager, check to the 'Obsolete' box, find the 'Android Support Library' package in 'Extras' group and install it.

打开SDK Manager,勾选“Obsolete”框,在“Extras”组中找到“Android Support Library”包并安装。

After then, your project can be create normally.

之后,您的项目就可以正常创建了。

Android SDK Manager screenshot

Android SDK 管理器截图