我的安卓应用程序的自动备份不起作用



我在我的build.gradle中瞄准了API 23。我已允许在我的清单文件中备份。我可以使用 adb shell 命令测试自动更新。但是自动备份不会在我的设备上自行发生。我在Settings -> Backup & Reset中将"备份我的数据"设置为"开"。还设置了备份帐户。但是我的应用程序的备份没有发生。在 Google 云端硬盘设置的"管理备份"中,我的应用未列在备份到 Google 云端硬盘的应用中。我正在遵循其他条件,例如保持 Wi-Fi 打开、手机使用充电器并保持空闲状态。我哪里出错了?是因为它是一个调试应用程序而不是发布应用程序吗?以下是我的build.gradlemanifest文件中的配置:

清单

<application
            android:name=".app.GlobalState"
            android:allowBackup="true"
            android:fullBackupOnly="true"
            android:icon="@drawable/app_icon"
            android:label="@string/app_name"
            android:theme="@style/TripAppTheme"> 

build.gradle

apply plugin: 'com.android.application'
android {
    compileSdkVersion 'Google Inc.:Google APIs:24'
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.spiritapps.android.tripplannerapp"
        minSdkVersion 16
        targetSdkVersion 23
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
        }
        applicationVariants.all { variant ->
            variant.outputs.each { output ->
                output.outputFile = file("$project.buildDir/apk/MyApp.apk")
            }
        }
    }
}
dependencies {
    compile 'com.android.support:support-v13:25.1.0'
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.google.android.gms:play-services-auth:10.2.0'
    compile 'com.google.android.gms:play-services-base:10.2.0'
    compile 'com.google.android.gms:play-services-identity:10.2.0'
    compile 'com.google.android.gms:play-services-analytics:10.2.0'
    compile 'com.google.android.gms:play-services-drive:10.2.0'
    compile 'com.google.android.gms:play-services-location:10.2.0'
    compile 'com.google.android.gms:play-services-maps:10.2.0'
    compile 'com.google.android.gms:play-services-ads:10.2.0'
    compile 'com.google.android.gms:play-services-places:10.2.0'
    compile 'joda-time:joda-time:2.2'
}

另外,wi-fi有必要还是数据连接也可以工作?

我已经让它工作了,这是我的清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
          android:versionCode="2" 
          android:installLocation="auto" 
          package="com.example.myApplication" 
          android:versionName="2.0">
    <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="23" />
    <application android:label="My Application" 
                 android:icon="@drawable/icon" 
                 android:fullBackupContent="true"/>
</manifest>

此外,使用此清单,我已将应用程序"部署"到设备,而不仅仅是从 IDE 运行/调试。显然,我不得不等待几个小时才能知道这个东西正在工作,因为我们无法控制备份过程何时在设备上开始。

哦,顺便说一句,我正在使用Xamarin Forms和VS2017。呵呵。

最新更新