【问题标题】:New Android project fails to create successfully新建Android项目创建失败
【发布时间】:2014-11-25 22:40:33
【问题描述】:

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

eclipse 版本:

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

ADT 最新版本来自:

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

在 Windows 64 位上。

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

应用程序名称:DemoProject 项目名称:DemoProject 包名:com.example.demoproject 最小 SDK:API8 目标:API21 使用 API21 编译 主题:带有深色操作栏的全息灯

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

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

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

[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] 

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

【问题讨论】:

    标签: android eclipse adt eclipse-adt


    【解决方案1】:

    转到 Android SDK Manager 并下载 Android 支持库,如下所述:No resource found that matches the given name '@style/Theme.AppCompat.Light'

    由于您希望从第 8 级开始支持 Api,并且主题发生了很大变化,因此您需要一些库来实现“复古兼容性”。 编码时也要注意,管理不同的版本,导入正确的包。

    【讨论】:

    • 这实际上已经安装了——但是它应该有的目录中不存在源代码,所以我删除了这个包——重新安装并且它工作了。
    【解决方案2】:

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

    【讨论】:

      【解决方案3】:

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

      如何安装?

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

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

      【讨论】:

        猜你喜欢
        • 2016-04-09
        • 2019-09-22
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多