Android Studioの “On SDK version 23 and up, your app data will be automatically backed up and restored on app install.” の警告への対処

前回記載した「Android Studioの “App is not indexable by Google Search; consider adding at least one Activity with an ACTION-VIEW intent filter.” 警告への対処 – senooken.jp」に対応すると今度は以下の警告が出るようになってしまった。
Warning:(5, 6) On SDK version 23 and up, your app data will be automatically backed up and restored on app install. Consider adding the attribute `android:fullBackupContent` to specify an `@xml` resource which configures which files to backup. More info: https://developer.android.com/training/backup/autosyncapi.html
Android 6.0 (APIレベル23) からアプリデータの自動バックアップ機能が追加されている。これに対応するために,android:fullBackupContent
属性を追加しろという指摘となっている。
警告に掲載されている参考URLの [https://developer.android.com/training/backup/autosyncapi.html] にアクセスすると「自動バックアップでユーザーデータをバックアップする | Android デベロッパー | Android Developers」にリダイレクトされるが,内容は同じなのでこれを参考にする。
警告やガイドに従ってapplication
要素の属性にandroid:fullBackupContent="@xml/backup_rules"
を追加すると,今度は以下の警告が出る。
Warning:(12, 36) Missing `<full-backup-content>` resource
バックアップ対象のルール定義ファイル (res/xml/backup_rules.xml
) にfull-backup-content
要素の記述が必要なようだ。
ただ,余計なファイルを増やしたくなく,アプリのバックアップ機能は必要でない。
警告が出るのが面倒くさいので,application
要素のandroid:allowackup="false"
の属性を指定しすることでバックアップを無効化して,以下のように対応した。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="jp.senooken.android.edittextinlistview">
<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
これで警告も出なくなり,特に問題ないのでこれでよしとする。