ActivityManager: Warning: Activity not started,...

Activity not started, its current task has been brought to the front的解决办法
2011-05-08 19:36

          在编译NDK程序时,因为修改了一下C++代码,用Cygwin从新编译后,而后在eclipse中运行程序时, console输出界面显示android

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

          这时候发现模拟器上显示的内容仍是原来的;eclipse

          对于这个问题具体缘由还不是很清楚,但在调式的时候发现,这样作能够解决这个问题;首先在Package Explorer中找到要运行的程序,而后点击右键,选中 refresh, 而后再选中run as -----> android application,最后解决了问题;spa

          对比没有通过 refresh 和 通过 refresh 这步, 观察console输出时,发现二者有不一样的部分code

 

如下是通过 refresh 这步在console输出的信息orm

[2011-05-08 19:13:11 - HelloWjr] Android Launch!
[2011-05-08 19:13:11 - HelloWjr] adb is running normally.
[2011-05-08 19:13:11 - HelloWjr] Performing com.wjr.hellowjr.HelloWjr activity launch
[2011-05-08 19:13:11 - HelloWjr] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'android2.2'
[2011-05-08 19:13:11 - HelloWjr] Uploading HelloWjr.apk onto device 'emulator-5554'
[2011-05-08 19:13:11 - HelloWjr]Installing HelloWjr.apk...
[2011-05-08 19:13:17 - HelloWjr]Success!
[2011-05-08 19:13:17 - HelloWjr] Starting activity com.wjr.hellowjr.HelloWjr on device emulator-5554
[2011-05-08 19:13:20 - HelloWjr] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.wjr.hellowjr/.HelloWjr }
ip

 

如下是没有通过 refresh 这步在console输出的信息get

[2011-05-08 19:12:55 - HelloWjr] Android Launch!
[2011-05-08 19:12:55 - HelloWjr] adb is running normally.
[2011-05-08 19:12:55 - HelloWjr] Performing com.wjr.hellowjr.HelloWjr activity launch
[2011-05-08 19:12:55 - HelloWjr] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'android2.2'
[2011-05-08 19:12:57 - HelloWjr]Application already deployed. No need to reinstall.
[2011-05-08 19:12:57 - HelloWjr] Starting activity com.wjr.hellowjr.HelloWjr on device emulator-5554
[2011-05-08 19:12:59 - HelloWjr] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.wjr.hellowjr/.HelloWjr }
[2011-05-08 19:13:00 - HelloWjr] ActivityManager: Warning: Activity not started, its current task has been brought to the front
it

 

在网上找到比较靠谱的解释:Are you getting the warning when you start the app? If you run an app from eclipse without it having to recompile (ie no code changes), it doesn't go through the uninstall-install process, it just pushes the application to the front just like you would if you resumed it from the phone. It's not an error but a 'working as intended'!io

也就是在修改了代码后,在没有从新编译这步, 模拟器原来的.apk就不会通过卸载跟从新安装这一步;因此当在eclipse中只是点击运行时,因为如今的程序没有通过编译这一步,因此安装的程序跟原来的同样, 因此在console输出的信息中会出现这一行信息:

相关文章
相关标签/搜索