76

I have a very simple android project. I got the following error message when I try to run it. The emulator is running but the application doesn't come up. I couldn't find any useful information online. Can anyone help me?

Warning: Activity not started, its current task has been brought to the front

public class Profile extends Activity {
        /*Button button1;
        CheckBox check1, check2;
        EditText text1;*/

        /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
     }
}

<EditText android:text="@+id/EditText01" android:id="@+id/EditText01"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:enabled="false"></
EditText><CheckBox android:text="@+id/CheckBox03" android:id="@+id/
CheckBox03" android:layout_width="fill_parent"
android:layout_height="wrap_content">
</CheckBox>
<CheckBox android:text="@+id/CheckBox02" android:id="@+id/CheckBox02"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</CheckBox>
<CheckBox android:text="@+id/CheckBox01" android:id="@+id/CheckBox01"
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:checked="true">
</CheckBox>

</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.seiservices.blending"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/
app_name">
        <activity android:name=".Profile"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
                <category
android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

    </application>
    <uses-sdk android:minSdkVersion="8" />

</manifest> 
finnw
  • 47,861
  • 24
  • 143
  • 221
Luyin Sun
  • 1,124
  • 1
  • 9
  • 21

8 Answers8

106

It is not an error message, it is a warning. It means that (a task of) the application is running and that even though a 'startActivity' request was made to run that task, or another activity in the application. The system is just bringing the current task of that application to the foreground. (This can occur if you are running in Eclipse or AndroidStudio with the emulator.)

What the system is trying to tell you: The application on the device is the same as your application in Eclipse. And because the application is already running on the device, the system tells you that it is not going to kill and restart it, but bring the activity of your already running app into the foreground. This is pretty normal. ;-)

The warning will not continue if you edit your code and run it (because the app is then killed, reinstalled and started) or if you kill your process on the phone, e.g. via the DDMS.

Ribo
  • 3,363
  • 1
  • 29
  • 35
mreichelt
  • 12,359
  • 6
  • 56
  • 70
  • 2
    Thanks for your quick comment. However I couldn't see my app running in the emulator. The emulator is running and all I can see is the home screen. What should I do to see my app? When I first created the app I can see it running in the emulator. – Luyin Sun Sep 23 '10 at 18:21
  • I think then you might give a shot for Robert's solution - maybe this is your problem. Otherwise: Upload your AndroidManifest.xml to http://pastebin.com and post the link here so we can have a look at it. :-) – mreichelt Sep 23 '10 at 19:44
  • 1
    To run DDMS, from Eclipse: Click Window > Open Perspective > Other... > DDMS – dysbulic Sep 13 '13 at 21:42
  • 4
    @mreichelt: Where or what is "Robert's solution"? I do not see any occurrence of "Robert" anywhere in this question or its answers or comments other than in your comment. – O. R. Mapper Dec 15 '13 at 11:24
  • I am using the -S argument: `adb shell am start -S -n my.compoent` and this is still occuring. Why? According to the docs at https://developer.android.com/studio/command-line/adb `-S` is supposed to "Force stop the target app before starting the activity". And yet, I'm still getting this warning. – Matt Groth Apr 01 '23 at 17:10
22

I've seen this before - you want to re-run your app even though you may not have made any code changes. On the emulator, click the back button (to the right of the menu button) and then run your app as usual from Eclipse.

John J Smith
  • 11,435
  • 9
  • 53
  • 72
8

This happens if you run an app from eclipse without recompiling (recompilation will not be done if you have not changed the code) it doesn't go through the uninstall-install process, instead it pushes the application to the front just like you start application from Home Launcher. It's not an error but a 'working as intended'.

Regards

Shraddha
  • 1,052
  • 11
  • 22
8

Project > Clean and then start your emulator again.

Matt
  • 3,882
  • 14
  • 46
  • 89
4

I found eclipse somehow got into a state where it was not building a new apk, even with code changes. Deleting the apk:

rm ./bin/"YOUR APP NAME".apk

and re-running your app from eclipse fixes the problem.

andii
  • 175
  • 1
  • 10
1

If you get this warning it means you haven't changed any line of your code and this instance of your project is running on emulator or on your device. So if you want to run that again you can:

1- Make some changes in your code and then compile it again.

2- Or you can easily close the app and then relaunch it with eclipse or android studio or ...

If the problem still persist try to uninstall the app and run it again.

Milad Faridnia
  • 9,113
  • 13
  • 65
  • 78
0

On the emulator,

  • press "Home"
  • "Menu" button -> scroll through the list and select the app which you are running
  • press "Force Stop".
Rathakrishnan Ramasamy
  • 1,612
  • 2
  • 25
  • 46
Sanjay
  • 1
0

This is warning It says app is already running.. I have solved it by recompiling my code and you can close your emulator and re run your app.. GoodLuck Happy coding