如何运行Android Support4Demo在Eclipse [英] How to run the Android Support4Demo in Eclipse

查看:161
本文介绍了如何运行Android Support4Demo在Eclipse的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与得到的Eclipse和运行建立了4级支持库的演示挣扎。道歉提前长度;我要完整地描述我做了什么。会的真正的AP preciate在这里让专家之一的帮助。

I'm struggling with getting the demo of the level 4 support library set up in Eclipse and running. Apologies in advance for the length; I want to completely describe what I have done. Would really appreciate the help of one of the experts here in SO.

下面是我做了什么 -

Here is what I've done -


  • 1 - 创建新项目:

  • 1 - Create New Project:

而不是试图让月食从现有的开源项目或从现有的样本项目,所有的问题,似乎是由于这些项目的设置方法我创建了一个新的项目。

Rather than trying to let Eclipse "Create project from existing source" or "Create project from existing sample" and all the problems that seem to result from those project setup approaches I created a new project.

2 - 'src'中,'水库'子目录:

2 - 'src', 'res' sub-directories:

删除了来自这些目录自动创建,然后复制文件夹结构和所有文件到从Support4Demo的SDK版本的项目中的所有文件。

Deleted all files that were auto-created from these directories and then reproduced the folder structure and all files into the project from the sdk version of the Support4Demo.

3 - 增加支持JAR

3 - Added support jar

创建了一个名为'库'的子目录,并添加了Android的支持 - v4.jar的复制到其中。然后,我已将此添加到构建路径(这导致了名为资料室,在它的Andr​​oid的支持,v4.jar文件的文件夹。

Created a sub-directory named 'lib' and added a COPY of the android-support-v4.jar to it. I then added this to the Build Path (this resulted in new folder named "Reference Libraries" with the android-support-v4.jar file in it.

4 - AndroidManifest.xml中:

4 - AndroidManifest.xml:

替换自动生成的清单与示范项目目录之一。

Replaced the auto-generated manifest with the one from the demo project directory.

我得到关于目标API级别月食的警告在

I get a warning from eclipse about the target API level in

Attribute minSdkVersion (4) is lower than the project target API level (13)

好吧,我明白的。 (我希望能在8级运行这个(或更低)的虚拟设备。这就是这种支持库是)。

OK, I understand that one. (I want to be able to run this on a level 8 (or lower) virtual device. That's what this support library is for.)

但我也得到一个的错误的清单文件,我不能做的意义 -

But I also get an error in the manifest file that I can't make sense of -

error: No resource identifier found for attribute 'stopWithTask'
in package 'android' AndroidManifest.xml /Supportv4Demo line 226
Android AAPT Problem

这是指清单中的线是一个服务引用 -

The line in the manifest that this refers to is a Service reference -

<service android:name=".content.LocalServiceBroadcaster$LocalService"
                     android:stopWithTask="true" />

我不是很用Eclipse经验(这肯定我的问题的一部分),但我怀疑,Eclipse已经修修补补用某种方式包括和我没有什么地方得到适当的包引用。我检查了类LocalServiceBroadcaster和它的'包括'这个样子 -

I'm not very experienced with Eclipse (and that's certainly part of my problem) but I suspect that Eclipse has tinkered with the includes somehow and that I'm not getting the proper package reference somewhere. I've inspected the class LocalServiceBroadcaster and it's 'includes' look like this -

package com.example.android.supportv4.content;

import com.example.android.supportv4.R;
import android.R.attr;
import android.app.Activity;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
... more includes
import android.support.v4.app.ServiceCompat;
import android.support.v4.content.LocalBroadcastManager;
... more includes

我如何得到支持库的设置和运行这个演示?结果
预先感谢任何帮助,您可以提供!

How do I get this demo of the support libraries setup and running?
Thanks in advance for any help you can provide!

推荐答案

正如你所看到的在该文档 stopWithTask 仅在API级别14及更高版本。要么改变你的目标SDK级别14或删除属性。 (这是什么做的包括)。

As you can see in the docs, stopWithTask is only available in API level 14 and above. Either change your target SDK level to 14 or remove that attribute. (It's nothing to do with the includes).

这篇关于如何运行Android Support4Demo在Eclipse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆