简体   繁体   English

新的Android项目无法成功创建

[英]New Android project fails to create successfully

I want to create an android project in eclipse. 我想在Eclipse中创建一个android项目。 Seems simple enough. 似乎很简单。 I downloaded and installed: 我下载并安装了:

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使用API​​21编译主题:带有深色操作栏的Holo light

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!? 真的不确定下一步是什么!?

Add the app-compat-v7 library to your project. 将app-compat-v7库添加到您的项目。 You can download it from your SDK Manager. 您可以从SDK Manager下载它。 Look for Support libraries. 查找支持库。

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 Manager并下载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,并且主题会发生很大变化,因此您需要一些库来实现“复古兼容性”。.在编写代码,管理不同版本和导入正确的程序包时也要注意。

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. 我确定您没有在SDK Manager中安装Android支持库。 (You can't see the Appcompat_v7 appear when you try to create a project.) (尝试创建项目时看不到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,选中“过时”框,在“其他”组中找到“ Android支持库”软件包并进行安装。

After then, your project can be create normally. 之后,您的项目即可正常创建。

Android SDK Manager屏幕截图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM