ActivityManager: Warning: Activity not started,...

面试:你懂什么是分布式系统吗?Redis分布式锁都不会?>>>   hot3.png

Activity not started, its current task has been brought to the front的解决办法

2011-05-08 19:36

          在编译NDK程序时,由于修改了一下C++代码,用Cygwin重新编译后,然后在eclipse中运行程序时, console输出界面显示

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

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

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

          对比没有经过 refresh 和 经过 refresh 这步, 观察console输出时,发现两者有不同的部分

 

以下是经过 refresh 这步在console输出的信息

[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 }

 

以下是没有经过 refresh 这步在console输出的信息

[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

 

在网上找到比较靠谱的解释: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'!

也就是在修改了代码后,在没有重新编译这步, 模拟器原来的.apk就不会经过卸载跟重新安装这一步;所以当在eclipse中只是点击运行时,由于现在的程序没有经过编译这一步,所以安装的程序跟原来的一样, 所以在console输出的信息中会出现这一行信息:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值