Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/349.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android应用程序进程在运行一段时间后自动终止_Java_Android_Activity Manager - Fatal编程技术网

Java Android应用程序进程在运行一段时间后自动终止

Java Android应用程序进程在运行一段时间后自动终止,java,android,activity-manager,Java,Android,Activity Manager,我的android应用程序在运行一段时间(1小时)后会自动终止,这是进程终止时打印到控制台的日志进程(PID 21659)已终止,在我的应用程序终止之前,还有其他与我的应用程序无关的服务终止。这是因为可用的CPU资源不足吗 日志 09-10 17:34:49.959 1601 20644 I ActivityManager Process com.qti.csm (pid 20762) has died 09-10 17:34:49.959 1601 20644 D

我的android应用程序在运行一段时间(1小时)后会自动终止,这是进程终止时打印到控制台的日志<代码>进程(PID 21659)已终止,在我的应用程序终止之前,还有其他与我的应用程序无关的服务终止。这是因为可用的CPU资源不足吗

日志

09-10 17:34:49.959  1601    20644   I   ActivityManager Process com.qti.csm (pid 20762) has died
09-10 17:34:49.959  1601    20644   D   ActivityManager cleanUpApplicationRecord -- 20762
09-10 17:34:49.960  1601    20644   W   ActivityManager Scheduling restart of crashed service com.qti.csm/.securityLog.RunTask in 66531ms

09-10 17:34:50.670  1601    13143   I   ActivityManager Process com.razorlabs.cpumeter (pid 23212) has died
09-10 17:34:50.670  1601    13143   D   ActivityManager cleanUpApplicationRecord -- 23212
09-10 17:34:50.680  1601    13143   W   ActivityManager Scheduling restart of crashed service com.razorlabs.cpumeter/.services.ServiceWorker in 75810ms
09-10 17:34:50.695  1601    9564    I   ActivityManager Process com.android.inputmethod.latin (pid 23423) has died
09-10 17:34:50.695  1601    9564    D   ActivityManager cleanUpApplicationRecord -- 23423
09-10 17:34:50.695  1601    9564    W   ActivityManager Scheduling restart of crashed service com.android.inputmethod.latin/.LatinIME in 85795ms

09-10 17:34:50.774  1601    1601    W   InputMethodManagerService   Session failed to close due to remote exception
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService   android.os.DeadObjectException
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at android.os.BinderProxy.transactNative(Native Method)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at android.os.BinderProxy.transact(Binder.java:615)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at com.android.internal.view.IInputMethodSession$Stub$Proxy.finishSession(IInputMethodSession.java:305)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at com.android.server.InputMethodManagerService.finishSessionLocked(InputMethodManagerService.java:1631)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at com.android.server.InputMethodManagerService.clearClientSessionLocked(InputMethodManagerService.java:1622)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at com.android.server.InputMethodManagerService.clearCurMethodLocked(InputMethodManagerService.java:1648)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at com.android.server.InputMethodManagerService.onServiceDisconnected(InputMethodManagerService.java:1667)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at android.app.LoadedApk$ServiceDispatcher.doDeath(LoadedApk.java:1469)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1483)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at android.os.Handler.handleCallback(Handler.java:751)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at android.os.Handler.dispatchMessage(Handler.java:95)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at android.os.Looper.loop(Looper.java:154)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at com.android.server.SystemServer.run(SystemServer.java:363)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at com.android.server.SystemServer.main(SystemServer.java:230)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at java.lang.reflect.Method.invoke(Native Method)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)

ActivityManager Process android.ext.services (pid 2274) has died
ActivityManager Process com.qualcomm.qcrilmsgtunnel (pid 2028) has died
ActivityManager Process com.android.smspush (pid 2093) has died
设备信息: 处理器:高通snapdragon 625
操作系统:Android N

您是否通过任何更改使用PackageManager对象? 我也遇到过同样的问题,结果是使用这个对象时出现了一个奇怪的bug,如果你使用太多,它可能会“死亡”,并导致你的应用程序也收到“死亡对象异常”。 如果没有,我建议您尝试注释出在这个异常之前可能添加的行,并尝试找出导致该问题的原因。
另外,如果有可能向我们提供代码,这将对Dan Baruch有所帮助,谢谢您的回复。我发现我的JNI代码中存在内存泄漏,这就是为什么安卓正在杀死我的服务和应用程序。奇怪的是,内存泄漏发生得非常缓慢,而且没有日志表明这是由于内存不足造成的

您的应用程序处于前台吗?你有一个持续通知在运行吗?嗨,chrylis,我的应用程序在进程结束后进入后台,我有一个前台服务在运行,但它不是一个持续服务。