How to run Android Support4Demo in Eclipse

I am trying to get a demo of the Level 4 Support Library installed in Eclipse and running. Sorry in advance for the length; I want to fully describe what I did. Would really appreciate help from one of the experts here at SO.

Here's what I did -

  • 1 - Create a new project:

    Instead of trying to let Eclipse "Build a project from an existing source" or "Build a project from an existing selection" and all the problems that come with these approaches to setting up a project, I created a new project.

  • 2 - 'src', res subdirectories:

    Removed all files that were automatically created from these directories and then reproduced the folder structure and all files in the project from the Support4Demo sdk version.

  • 3 - Added jar support

    Created a subdirectory named 'lib' and added COPY ofroid-support-v4.jar to it. Then I added this to the build path (which resulted in a new folder named "Reference Libraries" with the android-support-v4.jar file.

  • 4 - AndroidManifest.xml:

    Replaces the auto-generated manifest with the one found in the demo project directory.

Problem / Question

I am getting a warning from eclipse about the target API level in

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


Okay, I understand that. (I want to be able to run this on a level 8 (or lower) virtual device. What is this support library for.)

But I also get an error in the manifest file that I cannot understand -

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


The line in the manifest this refers to is a service link -

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


I'm not very experienced with Eclipse (and that's part of my problem, of course), but I suspect that Eclipse was messing with the included ones somehow and that I am not getting the correct package link somewhere. I checked out the LocalServiceBroadcaster class and it includes the following:


import android.R.attr;
import android.content.BroadcastReceiver;
import android.content.Context;
... more includes
... more includes


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


source to share

1 answer

As you can see in the docs , stopWithTask

only available in API 14 and up. Either change the target SDK level to 14, or remove this attribute. (This has nothing to do with inclusions).



All Articles