サムスンS3を除いて、すべての電話で問題なく動作するAndroidアプリを作成しました。何が起こるのは、私のアプリが動いている間、他のバックグラウンドプロセス(他のアプリ、つまり)が死ぬだろうということです。たとえば、私のアプリを使用してしばらくすると、ライブ壁紙が死ぬだろうし、ユーザーは自分のアプリを終了した後、自分の携帯電話で黒の背景を取得します。そして、最後に、それを使用してから、私のアプリもOSによって殺されます。何が不快なのは、ログにエラーメッセージが表示されず、正確に何が問題なのかのヒントが得られるということです。サムスンS3でアプリを実行しているときに、バックグラウンドプロセスがランダムに死ぬ
これはSamsung S3(S2ではなく)でのみ発生します。
私のアプリはメモリを大量に使用しているため(ウェブからたくさんの画像を読み込んでいます)、メモリに関係していると思っていましたが、ログに「メモリなし」のエラーは表示されません。
私が使っているHTTPフレームワークがバグかもしれないと思っていたので、Apache HttpComponentsからjava.net.HttpURLConnectionに切り替えましたが、役に立たなかったです。
なぜこれが起こっているのか、それをデバッグする方法のヒントについては、何か考えていただければ幸いです。ここで
が死んで、いくつかのバックグラウンドプロセスを示しているログからの抜粋である(例えば、ライブ壁紙):01-07 01:57:37.245: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x1
01-07 01:57:37.505: D/dalvikvm(29490): GC_FOR_ALLOC freed 1535K, 17% free 28032K/33735K, paused 71ms, total 71ms
01-07 01:57:37.580: D/dalvikvm(6718): WAIT_FOR_CONCURRENT_GC blocked 0ms
01-07 01:57:37.620: D/dalvikvm(6718): GC_EXPLICIT freed 91K, 9% free 17663K/19399K, paused 3ms+5ms, total 40ms
01-07 01:57:38.190: I/InputReader(2296): Touch event's action is 0x0 (deviceType=0) [pCnt=1, s=0.428 ]
01-07 01:57:38.190: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x0
01-07 01:57:38.190: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x0
01-07 01:57:38.190: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x0
01-07 01:57:38.190: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x0
01-07 01:57:38.190: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x0
01-07 01:57:38.335: I/InputReader(2296): Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=]
01-07 01:57:38.335: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x1
01-07 01:57:38.335: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x1
01-07 01:57:38.335: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x1
01-07 01:57:38.750: D/dalvikvm(29490): GC_FOR_ALLOC freed 1688K, 18% free 27981K/33735K, paused 114ms, total 114ms
01-07 01:57:39.695: W/PowerManagerService(2296): Timer 0x3->0x3|0x0
01-07 01:57:39.700: D/PowerManagerService(2296): setTimeoutLocked::SmartSleep : after19500
01-07 01:57:39.930: I/InputReader(2296): Touch event's action is 0x0 (deviceType=0) [pCnt=1, s=0.429 ]
01-07 01:57:39.930: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x0
01-07 01:57:39.930: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x0
01-07 01:57:39.930: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x0
01-07 01:57:39.930: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x0
01-07 01:57:39.930: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x0
01-07 01:57:40.020: D/DeviceInfo(2296): SysScope Service has unexpectedly disconnected!
01-07 01:57:40.065: I/InputReader(2296): Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=]
01-07 01:57:40.065: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x1
01-07 01:57:40.065: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x1
01-07 01:57:40.065: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x1
**01-07 01:57:40.080: I/ActivityManager(2296): Process com.android.smspush (pid 28031) (adj 1) has died.**
01-07 01:57:40.090: W/WallpaperService(2296): Wallpaper service gone: ComponentInfo{com.sec.ccl.csp.app.secretwallpaper.themetwo/com.sec.ccl.csp.app.secretwallpaper.themetwo.SecretWallpaperService}
01-07 01:57:40.125: D/KeyguardViewMediator(2296): setHidden false
**01-07 01:57:40.135: I/ActivityManager(2296): Process com.android.server.device.enterprise:remote (pid 28016) (adj 1) has died.**
**01-07 01:57:40.145: I/ActivityManager(2296): Process com.sec.ccl.csp.app.secretwallpaper.themetwo (pid 29715) (adj 1) has died.**
01-07 01:57:40.285: D/dalvikvm(29490): GC_CONCURRENT freed 1616K, 17% free 28289K/33735K, paused 27ms+21ms, total 178ms
01-07 01:57:40.285: D/dalvikvm(29490): WAIT_FOR_CONCURRENT_GC blocked 112ms
01-07 01:57:40.445: D/dalvikvm(2296): GC_CONCURRENT freed 1869K, 59% free 24186K/57991K, paused 26ms+12ms, total 197ms
01-07 01:57:40.660: D/dalvikvm(29490): GC_CONCURRENT freed 1587K, 16% free 28622K/33735K, paused 3ms+7ms, total 51ms
01-07 01:57:40.685: D/KeyguardViewMediator(2296): setHidden false
あなたの説明からこのようなエラーを追跡することは非常に困難です。しかし、それは特定のS3に関連している可能性があります。あなたは別のS3の携帯電話でそれを試すことができますか?私はこれは非常に奇妙なので、他のアプリがあなたによって殺され、しばらくするとあなたのアプリが殺されることを伝えている。おそらく、一般的にアプリを殺すようなものがあるかもしれません(ウイルスですか?またはメモリが不足していますか?)。さらにライブ壁紙はアンドロイドによって常に殺されますが、あなたの状況でリソースが解放されるとすぐに復元されます。そうでないと、システムのデフォルト動作が妨げられる可能性があります。 – Christos
私は3つの異なるS3デバイスを試しました(そしてそれらはすべて同じバージョンのAndroidを実行していませんでした)。問題はネイティブのメモリリークであった、私の答えを参照してください。 ( – kolufild