`
hold_on
  • 浏览: 451971 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

Unable to launch com.* for service Intent { cmp=com.*/.* }: process is bad

阅读更多

 最近的项目需要用到服务端收集客户端崩溃的详细异常log数据:

 

之前也做过,感觉很轻松,没想到遇到问题了,还纠结了半天:

 以下是关键log日志

05-04 20:28:42.409: W/ActivityManager(374): Process com.example.service has crashed too many times: killing!
05-04 20:28:42.409: I/ActivityManager(374): Killing proc 20556:com.example.service/u0a10080: crash
05-04 20:28:43.323: W/ActivityManager(374): Unable to launch app com.example.service/10080 for service Intent { cmp=com.example.service/.service.TestService }: process is bad

 

问题介绍:

a、带界面的应用,当应用拥有当前界面时发生RuntimeException,可以被alarm和BroadcastReceiver唤醒;

b、统计器后台运行:产生RuntimeException之后再也起不来了(不可以被alarm和BroadcastReceiver再次唤醒);

 

问题查找过程:

推荐一个在线查看源码的网站,很方便

http://grepcode.com/project/repository.grepcode.com/java/ext/com.google.android/android/

 

1、 关键词搜索:process is bad

2、发现出处

 class: com.android.server.am.ActivityManagerService 
    method: private final ContentProviderHolder getContentProviderImpl(IApplicationThread caller,
        String name, IBinder token, boolean stable, int userId);

    具体位置:

   

ProcessRecord proc = startProcessLocked(cpi.processName,
        cpr.appInfo, false, 0, "content provider",
        new ComponentName(cpi.applicationInfo.packageName,
                cpi.name), false, false);
if (proc == null) {
    Slog.w(TAG, "Unable to launch app "
            + cpi.applicationInfo.packageName + "/"
            + cpi.applicationInfo.uid + " for provider "
            + name + ": process is bad");
    return null;
}

 

 

 

 

3、继续跟踪 com.android.server.am.ActivityManagerService 的 startProcessLocked ,原因就在里头;

    

 

 

原因:

参考:

 

	class :	com.android.server.am.ActivityManagerService
	method: final ProcessRecordstartProcessLocked(String processName,
			ApplicationInfo info, boolean knownToBeDead, int intentFlags,
			String hostingType, ComponentName hostingName,
			boolean allowWhileBooting, boolean isolated) {}

 
   程序发生RuntimeException,被crash掉,如果被重新起来,这个时候判断是否是后台应用,如果是后台应用则silently fail.

 

 

   关键代码:红色标记注释

 

	if (!isolated) {
    if ((intentFlags&Intent.FLAG_FROM_BACKGROUND) != 0) {
        // If we are in the background, then check to see if this process
        // is bad.  If so, we will just silently fail.
        if (mBadProcesses.get(info.processName, info.uid) != null) {
            if (DEBUG_PROCESSES) Slog.v(TAG, "Bad process: " + info.uid
                    + "/" + info.processName);
            return null;
        }
    } else {
        // When the user is explicitly starting a process, then clear its
        // crash count so that we won't make it bad until they see at
        // least one crash dialog again, and make the process good again
        // if it had been bad.
        if (DEBUG_PROCESSES) Slog.v(TAG, "Clearing bad process: " + info.uid
                + "/" + info.processName);
        mProcessCrashTimes.remove(info.processName, info.uid);
        if (mBadProcesses.get(info.processName, info.uid) != null) {
            EventLog.writeEvent(EventLogTags.AM_PROC_GOOD,
                    UserHandle.getUserId(info.uid), info.uid,
                    info.processName);
            mBadProcesses.remove(info.processName, info.uid);
            if (app != null) {
                app.bad = false;
            }
        }
    }

 

 

 

0
0
分享到:
评论
1 楼 dufangyu1990 2015-07-21  
请问该如何解决呢?

相关推荐

    安卓手机购物清单

    安卓手机购物清单 The applications require: * The latest Android 2.3 SDK * Ant 1.8 (if you are using ant) Most projects depend on the OI ...* the OI Distribution Library is included automatically.

    安卓手机文件管理

    简单的安卓手机文件管理 Jan 17, 2011 The applications require: * The latest Android 2.3 SDK * Ant 1.8 (if you are using ant) ...* the OI Distribution Library is included automatically.

    Delphi7.1 Update

    This update can not be removed after it is installed.* You will need the original Delphi 7 installation CD available to install this update.* To install this update from the CD, insert the CD, and ...

    端口查看工具

    process that opened the port is also displayed, including the process name, full path of the process, version information of the process (product name, file description, and so on), the time that the ...

    ethminer-0.16.0.dev3

    [Genoil's fork] was the original source of this version, but as Genoil is no longer consistently maintaining that fork it became almost impossible for developers to get new code merged there....

    BaiduNetdisk_mac_3.4.1.dmg

    百度网盘mac

    npp 记事本 对各种编程语言提供编辑支持

    What is Notepad++? ****************** Notepad++ is a free (as in "free speech" and also as in "free beer") source code editor and Notepad replacement that supports several programming languages and ...

    LaunchImage.zip

    iOS 13 LaunchScreen.storyboard 启动图屏幕适配

    VSCode 报错”unable to start debugging.unable to establish a connetcion to GDB” 问题解决方案.

    今天给人配置环境, 遇到了 “unable to start debugging.unable to establish a connetcion to GDB” 这个问题, launch 和 tasks 都完全没有问题, 都可以运行 code-runner, 就是不能连接 gdb 启动调试, 这可真是奇葩...

    Android代码-marketlauncher

    A small helper application, intended to open Android Market URLs from a browser (which normally they refuse to do). Registers to handle urls in the 'marketlauncher:' scheme from the browser. Checks ...

    IOS使用Launch Screen.storyboard制作广告启动界面

    IOS制作启动广告图,兼容LaunchImage加载启动图和LaunchScreen启动,详细讲解可以查看博客:http://blog.csdn.net/wx_jin/article/details/50617041

    天融信防火墙配置

    天融信防火墙配置,符合日常企业的网络管理,对网络管理员来说是一个不错的选择

    在Ubuntu中安装VSCode并配置C/C++开发环境的方法步骤

    官网地址:https://code.visualstudio.com/docs/?dv=linux64_deb 然后使用 sudo dpkg -i xxx.deb解压即可 第二步,如果你的电脑中没有gcc,g++,gdb的话,可以通过以下代码获得。 sudo apt-get update //访问源列表...

    SDK文件下缺少emulator-2

    信得过我就下载,肯定成功...11:43 Emulator: Could not launch 'D:\AndroidSDK\emulator/qemu/windows-x86_64/qemu-system-i386.exe': No such file or directory 11:43 Emulator: Process finished with exit code 2

    LaZagne查看计算机密码

    * Launch all modules * cmd: laZagne.exe all * Launch only a specific module * cmd: laZagne.exe * example: laZagne.exe browsers * help: laZagne.exe -h * Launch only a specific software script *...

    RunAsTI-master.zip

    Is a tool to launch a program of choice (usually cmd.exe) with the same privileges as the TrustedInstaller. That privilege is very powerfull! Actually the tool makes a clone of the token from Trusted...

    org.apache.tools.*需要的ant.jar包

    java调用ant构建打包,java调用ant构建打包,java调用ant构建打包,java调用ant构建打包,

    android 8.1设置添加Ethernet功能选项

    <category android:name="android.intent.category.VOICE_LAUNCH" /> <category android:name="com.android.settings.SHORTCUT" />+ </intent-filter> <meta-data android:name=...

    联想旭日420AXP系统芯片组驱动

    This software is designed for the latest service pack releases of above operating systems. To verify which operating system has been installed onto the target system, follow the steps below: ...

    webplugin海康网站视频插件

    webplugin海康网站视频插件

Global site tag (gtag.js) - Google Analytics