Cannot build an APK due to problems with AndroidMa

2019-07-03 18:58发布

问题:

For some reason, whenever I load my project, I immediately get the following error:

The code in my AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.avi12.palindrome"
    android:versionCode="59"
    android:versionName="3.3" >

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="27" />

    <application
        android:allowBackup="true"
        android:debuggable="true"
        android:fullBackupContent=""
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.avi12.palindrome.MainActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <!--
             ATTENTION: This was auto-generated to add Google Play services to your project for
             App Indexing.  See https://g.co/AppIndexing/AndroidStudio for more information.
        -->
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

        <activity
            android:name="com.google.android.gms.common.api.GoogleApiActivity"
            android:exported="false"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />

        <provider
            android:name="com.google.firebase.provider.FirebaseInitProvider"
            android:authorities="com.avi12.palindrome.firebaseinitprovider"
            android:exported="false"
            android:initOrder="100" />

        <meta-data
            android:name="android.arch.lifecycle.VERSION"
            android:value="27.0.0-SNAPSHOT" />
    </application>

</manifest>

I tried cleaning the project, but it didn't help,
I'm unsure what's causing these errors.
As a result, I cannot build an APK.
How do I solve this? Thanks!

回答1:

android:fullBackupContent="" cannot be empty so it should point to XML which should contains the rules to define the backup policy

From Docs In AndroidManifest.xml, add the android:fullBackupContent attribute to the <application> element. This attribute points to an XML file that contains backup rules. For example:

<application ...
    android:fullBackupContent="@xml/my_backup_rules">
  </app>

Create an XML file called my_backup_rules.xml in the res/xml/ directory. Inside the file, add rules with the <include> and <exclude> elements. The following sample backs up all shared preferences except device.xml:

<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
    <include domain="sharedpref" path="."/>
    <exclude domain="sharedpref" path="device.xml"/>
</full-backup-content>

or
From error logs you can also define boolean value as

// hasn't test it but
// judging from error android:fullBackupContent (attr)reference|boolean
android:fullBackupContent=false 


回答2:

Either remove this from your manifest android:fullBackupContent="" or create your xml rules and add them here like android:fullBackupContent="@xml/my_backup_rules" where my_back_rules is a xml file your create which have set rules to define which files to back up.

https://developer.android.com/guide/topics/data/autobackup.html

Go this link for more information.