Napisałem aplikację na Androida, która działa bezproblemowo na każdym telefonie, z którego próbowałem, z wyjątkiem Samsunga S3. Co się stanie, podczas gdy moja aplikacja będzie działać, inne procesy w tle (inne aplikacje) zaczną ginąć. Na przykład, po pewnym czasie korzystania z mojej aplikacji, Live Wallpaper umrze, a użytkownik dostanie czarne tło na swoim telefonie po wyjściu z mojej aplikacji. I wreszcie, po pewnym czasie korzystania z niej moja aplikacja jest również zabijana przez system operacyjny. Frustrujące jest to, że nie widzę w dzienniku żadnego komunikatu o błędzie, który dałby mi wskazówkę, na czym dokładnie polega problem.Procesy w tle losowo wymierające, gdy aplikacja działa na Samsung S3
Zdarza się to tylko na Samsung S3 (a nie na S2, na przykład).
Pomyślałem, że jest to związane z pamięcią, ponieważ moja aplikacja bardzo intensywnie korzysta z pamięci (ładuje wiele obrazów z internetu), ale nie widzę żadnych błędów "brak pamięci" w dzienniku.
Podejrzewałem również, że framework HTTP, którego używam, może być błędny, więc przełączyłem się z Apache HttpComponents na java.net.HttpURLConnection, ale to nie pomogło.
Każdy pomysł o tym, dlaczego tak się dzieje lub wskazówka, jak go usunąć, byłby doceniony.
Oto fragment z dziennika, który wykazuje pewne procesy w tle umierających (np Live Wallpaper):
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
Z Twojego opisu jest bardzo trudno wyśledzić taki błąd. Może być jednak związany z konkretnym S3. Czy możesz wypróbować to na innym telefonie S3? Mówię to, ponieważ jest bardzo dziwne, że inne aplikacje są zabijane przez Ciebie i po chwili twoja aplikacja zostanie zabita. Może jest coś, co zabija aplikacje ogólnie (wirus lub wadliwa pamięć?). Co więcej, tapety na żywo są zabijane przez cały czas przez Androida, ale są przywracane, gdy tylko zasoby zostaną uwolnione w twojej sytuacji, nie są więc możliwe, że coś uniemożliwia domyślne zachowanie systemu. – Christos
Próbowałem na 3 różnych urządzeniach S3 (i one nie były nawet uruchomione w tej samej wersji Androida). Problem był w wycieku pamięci natywnej, zobacz moją odpowiedź. Naprawdę trudno było wyśledzić :( – kolufild