8

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

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

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

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

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

我目前正在检查是否没有调用任何 BackupManager API 可以解决这个意外/静默强制停止。现在看起来还可以。

有什么建议吗?

4

1 回答 1

6

使用 Android Studio 中的 gradle,您可以使用 AndroidManifest.xml 文件为您的调试构建创建一个调试目录,以禁用 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>
于 2015-02-19T08:45:54.557 回答