本文介绍了BackupManagerService恢复超时导致强制停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从昨天开始,我的Nexus 5正在运行Lollipop,并且我正在处理的应用程序正在停止运行,而没有发生任何崩溃.

Since yesterday, my Nexus 5 is running Lollipop and the application I am working on is stopping without any crash.

每次退出时,设备都会记录以下内容:

Each time it exits, the device logs the following:

11-20 00:23:32.679: I/ActivityManager(723): START u0 {flg=0x14008000 cmp=com.mycompany.android/.app.LoginActivity} from uid 10549 on display 0
11-20 00:23:32.713: W/ActivityManager(723): Duplicate finish request for ActivityRecord{2cd672e4 u0 com.mycompany.android/.app.StartupActivity t39 f}
11-20 00:23:32.926: I/ActivityManager(723): Displayed com.mycompany.android/.app.LoginActivity: +223ms
11-20 00:23:45.734: I/ActivityManager(723): Force stopping com.mycompany.android appid=10549 user=-1: uninstall pkg
11-20 00:23:45.734: I/ActivityManager(723): Killing 24090:com.mycompany.android/u0a549 (adj 0): stop com.mycompany.android
11-20 00:23:45.793: W/ActivityManager(723): Force removing ActivityRecord{5367f0c u0 com.mycompany.android/.app.LoginActivity t39}: app died, no saved state
11-20 00:23:45.846: W/ActivityManager(723): Spurious death for ProcessRecord{33eaa703 24090:com.mycompany.android/u0a549}, curProc for 24090: null
11-20 00:23:45.853: I/ActivityManager(723): Force stopping com.mycompany.android appid=10549 user=0: pkg removed
11-20 00:23:46.188: D/BackupManagerService(723): Received broadcast Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.mycompany.android flg=0x4000010 (has extras) }
11-20 00:24:23.646: E/BackupManagerService(723): Timeout restoring application com.mycompany.android
11-20 00:24:23.647: W/BackupManagerService(723): Tried to clear data for com.mycompany.android but not found
11-20 00:26:49.647: V/BackupManagerService(723): restoreAtInstall pkg=com.mycompany.android token=a restoreSet=3319d18fd0806258
11-20 00:26:50.025: I/BackupTransportService(1752): Current restore app : com.mycompany.android
11-20 00:26:50.027: I/BackupManagerService(723): Next restore package: RestoreDescription{com.mycompany.android : KEY_VALUE}
11-20 00:26:50.028: V/BackupManagerService(723): Package com.mycompany.android restore version [0] is compatible with installed version [0]
11-20 00:26:50.028: W/BackupManagerService(723): Signature mismatch restoring com.mycompany.android
11-20 00:26:50.236: D/BackupManagerService(723): Received broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.mycompany.android flg=0x4000010 (has extras) }
11-20 00:26:50.240: D/BackupManagerService(723): Now staging backup of com.mycompany.android

听起来像系统决定强制停止我的应用程序,因为恢复超时.当应用正确签名后,也会发生这种情况.

It sounds like that the system decides to force stop my application because the restoration times out.It also happens when the app is correctly signed.

与BackupManager相关的实现在4.4.2之前运行良好.

BackupManager related implementation was running fine until 4.4.2.

我目前正在检查是否不调用任何BackupManager API可以解决这种意外/无声的强制停止.现在看来还可以.

I am currently checking if not invoking any BackupManager APIs works around this unexpected/silent force-stop. For now it looks ok.

有什么建议吗?

推荐答案

借助Android Studio中的gradle,您可以使用AndroidManifest.xml文件创建一个调试目录,以便您的调试版本禁用BackupManager:

With gradle in Android Studio you can create a debug directory with an AndroidManifest.xml file for your debug build to disable the BackupManager:

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <application
        android:allowBackup="false"
        tools:replace="android:allowBackup">

    </application>
</manifest>

这篇关于BackupManagerService恢复超时导致强制停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-18 09:38