Can't debug through onReceive() in boot completed receiver - android

Thanks a ton to this site, I have made significant progress with my first Android project.
I'm trying to get the execution suspend in the onReceive() method of a boot completed receiver. Below are my manifest and receiver code.
Android 2.3.3
API - 10
IDE - Eclipse
Running on emulator
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.demo.notepad3" >
<uses-sdk android:minSdkVersion="10" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application android:icon="#drawable/icon" >
<activity
android:label="#string/app_name"
android:name=".ProjectTrackerHomeActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ProjectTrackerEditActivity" />
<receiver android:name=".ProjectTrackerNotification" />
<receiver
android:name=".ProjectTrackerOnBootReceiver" >
<intent-filter >
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
</application>
</manifest>
Receiver:
public class ProjectTrackerOnBootReceiver extends BroadcastReceiver {
private ProjectTrackerDBAdapter mDbHelper;
#Override
public void onReceive(Context context, Intent intent) {
Debug.waitForDebugger();
AlarmManager
mgr=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
//I place the break point at line 2, the alarm manager line
// Further code, irrelevant
}
My observations -1. When I run this application in debug mode on eclipse, the break point is not even hit.2. When I run some other application in debug mode, this break point is hit momentarily! But before I can proceed with a step by step execution, the execution resumes. It doesn't stop there.
My reasoning for this behavior is that -1. When I run some other application, since this above app is already installed, it catches the boot complete broadcast and so the breakpoint is hit. (But why doesn't the execution halt at the breakpoint?)2. When I run only this app, it gets installed first and in the time it takes for installation, it misses the boot complete broadcast.
May I please get some assistance with the below queries -1. How can I make the execution halt at the breakpoint without it resuming further?2. Can I somehow run an already installed version of this app on the emulator in debug mode "without having it to get freshly installed" on the emulator every time I run it?
3. Is there anything else I'm doing wrong or missing something?
Kindly let me know since I really need to debug through onReceive() to catch further application logic bugs. Thanks a lot, folks.

You need to shutdown the phone and start it up to ever see onReceive get called from bootcompleted. To debug this, just add a Log statement in onReceive instead of setting a breakpoint. Otherwise, you'll have to add some action to the receiver in the manifest and then manually sendBroadcast(new Intent("someName")) with the name you specified in the receiver element in the manifest.

Not sure why this question is asked so many times and it was so hard to find the answer but this works like a champ for me.
In your receiver class within the onReceive() override add the below call for waitForDebugger() as the first call.
Deploy to the device by running the app.
Once the updated apk is on the device, reboot the device.
While device is rebooting return to your IDE (In this example Android Studio 1.4) and go to "Run" menu > "Attach debugger to Android Process".
Check "Show all processes".
Wait... Once the waitForDebugger() line is hit, your app/package will appear in this list. In my case, it took at least 2 minutes AFTER the device rebooted.
Click "OK", wait a moment and your breakpoint will be hit.
You can now step through your code like normal. Have fun!
#Override
public void onReceive(Context context, Intent intent) {
// Add this at beginning of method
android.os.Debug.waitForDebugger();
// Place breakpoint below
String myVariable = "Some Value";
}

Another method which I prefer as it means you do not need to keep restarting the device(boring, gradle takes long enough to load as it is), is to simply run the app in debug mode and then simulate an action which will call your Broadcast receiver using the following command in your terminal.
adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -p com.example.package_name
The above creates a broadcast with action "BOOT_COMPLETE" and now you can debug without restarting.

Use the below line before the code where you want the debugger to stop:
android.os.Debug.waitForDebugger();

Related

Activity start Errors [duplicate]

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>
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.
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.
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
Project > Clean and then start your emulator again.
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.
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.
On the emulator,
press "Home"
"Menu" button -> scroll through the list and select the app which you
are running
press "Force Stop".
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

Android Custom Launcher doesn't stop the BootAnimation

I am working on a custom launcher for Android, in a project using BBBAndroid (android v4.4.4 w/ kernel 3.8 for the beagleboneblack):
http://bbbandroid.sourceforge.net
I created aosp_stripped.mk to strip some unneeded Android packages and replace the Launcher2 and the HOME packages with my CustomLauncher. This launcher is mostly an normal app with the LAUNCHER and HOME category added in its AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="test.customlauncher" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_people"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<uses-library
android:name="test.service.lib"
android:required="true" />
<activity
android:launchMode="singleTask"
android:stateNotNeeded="true"
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
It effectively replaces Launcher2, but the boot animation doesn't stop until 40 seconds later, logcat shows:
W/WindowManager( 591): ***** BOOT TIMEOUT: forcing display enabled
I/PowerManagerService( 591): Boot animation finished.
So my launcher must be missing something to tell the boot animation to stop. I found some hints here: http://forum.xda-developers.com/showthread.php?t=2485118
Indeed, I have some missing Wallpaper classes errors in logcat, but I didn't remove the SystemUI package. I noticed that when using Launcher2/Home, this error only happens on the first boot. Using my custom launcher, it happens on every boot. Besides this error, I didn't find any differences:
W/WallpaperService( 591): Attempted wallpaper ComponentInfo{com.android.wallpaper/com.android.wallpaper.fall.FallWallpaper} is unavailable
W/WallpaperService( 591): Failure starting previous wallpaper
W/WallpaperService( 591): Attempted wallpaper ComponentInfo{com.android.wallpaper/com.android.wallpaper.fall.FallWallpaper} is unavailable
E/WallpaperService( 591): Default wallpaper component not found!
I found this class in the package LiveWallpapers in packages/wallpapers/Basic (AOSP). It is already added in PRODUCT_PACKAGES, but this package is nowhere in out/target/product/beagleboneblack/ :(
Right now I am digging in Launcher2 and WallPaperManager to see what could trigger the BootAnimation to stop...
Thanks in advance !
Update
I also tried to stop the bootanimation using system properties, but the touchscreen is not usable until the BOOT_TIMEOUT event:
import android.os.SystemProperties;
// inside a Service with system privileges
SystemProperties.set("service.bootanim.exit", "1");
Tracing the BOOT TIMEOUT problem, it comes from WindowManagerService performEnableScreen() waiting for a wallpaper to be set/active, the boot isn't considered done otherwise:
// If we are turning on the screen after the boot is completed
// normally, don't do so until we have the application and
// wallpaper.
if (mSystemBooted && ((!haveApp && !haveKeyguard) ||
(wallpaperEnabled && !haveWallpaper))) {
return;
}
I also noticed that the wallpapers apks in packages/wallpapers are not built for the target because the bbbandroid repo lacks opengl support for now.
My current workaround for this problem is to disable the WallpaperService via its internal config.xml file:
diff --git a/frameworks/base/core/res/res/values/config.xml b/frameworks/base/core/res/res/values/config.xml
index 6efb4a4..0c873b7 100644
--- a/frameworks/base/core/res/res/values/config.xml
+++ b/frameworks/base/core/res/res/values/config.xml
## -701,7 +701,7 ##
<string name="default_wallpaper_component" translatable="false">#null</string>
<!-- True if WallpaperService is enabled -->
- <bool name="config_enableWallpaperService">true</bool>
+ <bool name="config_enableWallpaperService">false</bool>
<!-- Whether to enable network location overlay which allows network
location provider to be replaced by an app at run-time. When disabled,
This solution works if you don't mind using modified android sources.
I think that the problem is not with your launcher app, in this case you would see in logcat errors from your app. Usually boot animation hangs when SystemUI can't start (due to a failure).
Launcher app itself doesn't stop boot animation, it doesn't have this functionality.
You probably disabled some critical component which breaks boot workflow. Yes, wallpapers can affect it. I would recommend to put everything back in your .mk file, check that it builds and boots OK, then replace launcher only with your app. Then you can cut mk file further to check which module creates the issue.
I do not remember exactly but Browser module may include webview component which is used by many components.
You should post full logcat output, and may be dmesg output as well.

Google Espresso java.lang.RuntimeException: Could not launch intent Intent { act=android.intent.action.MAIN

I am new to Espresso UI testing.
I am getting this error while running tests (ADT Eclipse IDE ).
The app is already developed and there are lots of request going on while launching the app. it is not possible to rewrite the app. but i need to find the way to test this UI even if there is any delay in the loading of the components.
java.lang.RuntimeException: Could not launch intent Intent { act=android.intent.action.MAIN flg=0x14000000 cmp=com.xx.android/com.yy.core.android.map.MapActivity } within 45 seconds. Perhaps the main thread has not gone idle within a reasonable amount of time? There could be an animation or something constantly repainting the screen. Or the activity is doing network calls on creation? See the threaddump logs. For your reference the last time the event queue was idle before your activity launch request was 1390913271702 and and now the last time the queue went idle was: 1390913271767. If these numbers are the same your activity might be hogging the event queue.
at com.google.android.apps.common.testing.testrunner.GoogleInstrumentation.startActivitySync(GoogleInstrumentation.java:277)
at android.test.InstrumentationTestCase.launchActivityWithIntent(InstrumentationTestCase.java:119)
at android.test.InstrumentationTestCase.launchActivity(InstrumentationTestCase.java:97)
at android.test.ActivityInstrumentationTestCase2.getActivity(ActivityInstrumentationTestCase2.java:104)
at com.gulesider.android.test.UItest.setUp(UItest.java:25)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:190)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:175)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
at com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner.onStart(GoogleInstrumentationTestRunner.java:167)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1799)
I have one library project called “Core” - it will not generate any .apk
Also i have one Android project called “AA” which will access “Core”. - This is AA.apk
Now i have created a test project called “UItest”
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.AA.android.test"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8"
android:targetSdkVersion="18" />
<instrumentation
android:name="com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
android:targetPackage="com.AA.android"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name="com.core.android.map.MapActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-library android:name="android.test.runner" />
</application>
</manifest>
My test:
public class UItest extends ActivityInstrumentationTestCase2<MapActivity> {
public UItest() {
super(MapActivity.class);
}
#Override
public void setUp() throws Exception {
super.setUp();
getActivity();
}
public void testSearchBox() {
Espresso.onView(ViewMatchers.withId(R.id.menu_button_logo)).perform(ViewActions.click());
}
}
For Espresso Testing it is highly recommend that you turn off system animations on the virtual or physical device(s) used for testing. So you can follow the steps below to manually turn off the animations:
Under:
Settings->
Developer options->
Drawing
Window Animations scale to OFF
Transition animation scale to OFF
Animator duration scale to OFF
If there is a progress bar running when you create the activity, you get an error like this. You should cause a stop for the progress bar in order to continue running the test.
I experienced this error while running Espresso tests on 6.0 devices but not on 5.1.1 or 7.0 devices. I tracked the cause down to using android:fadeScrollbars within a style. Removing this item from my style resolved the issue.
I have stuck into this problem for several hours. Finally, I got the reason.
This works for me.
Here are some different reasons, according to the phenomenon.
Activity can't be launched
Activity launched, but UI perform actions not work
The first scenario: activity can't be launched
Because of your target Activity maybe already in the activity stack.
Add a CLEAR flag and NEW_TASK flag
#get:Rule
val activityRule = ActivityTestRule<MainActivity>(MainActivity::class.java)
private lateinit var launchedActivity: MainActivity
#Before
fun setUp() {
val intent = Intent(Intent.ACTION_PICK)
//this is the key part
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
//this is the key part
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
launchedActivity = activityRule.launchActivity(intent)
}
The second scenario: activity launched but UI perform actions not work
In this scenario may be because of
Your code is executing some animation in a long time
Your code is doing a UI logic that you don't notice
(like Handler post event or runnable)
(register a listener in ViewTreeObserver like OnPreDrawListener and didn't unregister in a proper timing)
These actions may lead to UI thread busy, so the espresso can not do the test.
Probably you have animation inside your activity, which blocks espresso execution. You have to disable it - see https://github.com/googlesamples/android-testing/tree/master/ui/espresso/BasicSample
In my case a custom view caused this behaviour. It contained a Scroller which was constantly scrolling. Unfortunately, I didn't find a solution for this issue until now except disabling it for the tests...
If you are performing this test in MI or XIOMI phone then maybe it will not work so you can change device or you can use bluestack emulator. It will be work
At the very first page you will be calling too many request which will be taking time more than 15 seconds, the first page should be very lightwieght.
Just try by creating one new welcome page and then calling your original welcome page.
Hope this work for you.
Well, in my case it was caused by a strange thing.
One of my UI tests opened the external intent "android.app.action.CONFIRM_DEVICE_CREDENTIAL" so I decided to stub it. From now on, the MAIN intent didnt launch again until I manually closed the screen oipened by "android.app.action.CONFIRM_DEVICE_CREDENTIAL" from the recent tasks.
No idea why this happened, and have no time now for research. Maybe later I will update this thread.
I faced this error when I trying to test the opening of another activity when the user clicked on a given view. What I was doing wrong was not replacing:
#Rule
public ActivityTestRule<MyActivity> myActivityActivityTestRule = new ActivityTestRule<>(MyActivity.class);
Per:
#Rule
public IntentsTestRule<MyActivity> myActivityActivityTestRule =
new IntentsTestRule<>(MyActivity.class);
I had this problem too, and in the moment I changed physical device to other Android phone the tests were working. Just try to use other device. And use #rule for launching activity

Android Application onCreate not called for homescreen launcher app during reboot

I am having a strange problem in an Android application that I am building, the application is basically a Homescreen replacement app which will be put as a default homescreen in a device. To do some initialization work I have extended Android Application class and in the onCreate() method I am basically registering some observer and starting a service, here's the code:
public class MyApplication extends Application implements ExternalStorageListener {
private ExternalStorageObserver externalStorageObserver;
public void onCreate() {
Log.i("MyApplication", "Starting application");
super.onCreate();
externalStorageObserver = new ExternalStorageObserver(this);
if(externalStorageObserver.isExternalStorageAvailable()) {
// this builds a list of files present in the SD card
// which is being used through the application to do
// some work
buildData();
File externalFileDir = getApplicationContext().getExternalFilesDir(null);
if(externalFileDir != null && externalFileDir.isDirectory()) {
// do something...
}
}
//Register listener to observe external storage state
registerExternalStorageObserver();
Log.i("SyncService", "Starting sync service...");
ComponentName cmp = startService(new Intent(getApplicationContext(), SyncService.class));
Log.i("SyncService", cmp.toString());
}
private void registerExternalStorageObserver() {
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_MEDIA_MOUNTED);
filter.addAction(Intent.ACTION_MEDIA_REMOVED);
registerReceiver(externalStorageObserver, filter);
}
private void buildData() {
// builds a list
}
}
Content of Manifest file:
<application android:persistent="true" android:icon="#drawable/icon"
android:label="#string/app_name" android:name="com.webgyani.android.MyApplication"
android:debuggable="true">
<activity android:name=".HomeTabActivity" android:launchMode="singleInstance"
android:stateNotNeeded="true" android:theme="#style/LightTabsTheme"
android:screenOrientation="landscape" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
This works fine when I install the app either using Eclipse or manually installing the apk onto the device. Once the app is installed things work fine, I mean the above onCreate() method gets called and service is also started normally, but if I reboot the device this time the onCreate() method does not get called(none of the log statements appear and also the services are not started). After some debugging I noticed that this only happens if I set my app as the default launcher/homescreen app and thereafter reboots the device, because once you set the app as the default launcher, Android should automatically launch your app as the homescreen after reboot. In my case the app is launched but that code is not executed.
I tried to use debugger but that didn't work because when I reboot the device the debugger gets disconnected and by the time USB debugging gets enabled my app is already started.
I even double checked the Logcat but didn't see any error. I thought of having a BOOT_COMPLETED intent to initialize that part, but that will require some code refactoring which I am not willing to do at this point of time unless there is a solution.
So I am curious to know that whether this is a standard behavior, or is there a known bug which causes this, because my assumption is the onCreate method of the Application will always get called whenever the app is started. I have tried whatever I could since morning, but nothing worked, couldn't pinpoint the issue, if any of you could shed some light into this then that would be highly appreciated.
Thanks
Well, finally I figured out the problem, and it was in my code itself. I initially suspected that the MyApplication's onCreate() method was not getting called, I had that assumption because I was not able to see any logs. To know whether the method is getting called or not, instead of using Log.i() I was also appending some additional log messages in an ArrayList and printing them later, this revealed that the methods were indeed getting called and even the Service was instantiating properly but the data or filelist is not being populated because the SDCard was not ready by that time. I am also pretty sure that the logs were not available on Logcat due to the fact that the USB debugger becomes ready after my app is started(as it's a homescreen app).
The actual problem becomes obvious when you see that my overridden MyApplication class implements a listener called ExternalStorageListener which basically extends BroadcastReceiver, I have created that class to receive SDCard related Intents for example ACTION_MEDIA_MOUNTED, ACTION_MEDIA_REMOVED to rebuild the data(file list). In my case the ExternalStorageListener class was not receiving the Intents because I forgot to add this filter.addDataScheme("file") in the registerExternalStorageObserver method above in the code sample.
I do agree that my question was based on a false assumption and the code example I posted it's kind of hard to figure out the actual issue. I am not sure what to do with the question whether to mark this as answer or leave it as it is.

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

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>
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.
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.
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
Project > Clean and then start your emulator again.
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.
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.
On the emulator,
press "Home"
"Menu" button -> scroll through the list and select the app which you
are running
press "Force Stop".
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

Categories

Resources