> For the complete documentation index, see [llms.txt](https://docs.drivequant.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.drivequant.com/get-started-drivekit/android/troubleshooting.md).

# Troubleshooting

## `dataExtractionRules` property merge issue

If an error message appeared when building your app is something like:

> Error: Attribute application\@dataExtractionRules value=(@xml/data\_extraction\_rules) from AndroidManifest.xml:12:9-65 is also present at \[com.drivequant.drivekit:drivekit-core:x.x.x] AndroidManifest.xml:13:9-56 value=(@xml/backup\_rules). Suggestion: add 'tools:replace="android:dataExtractionRules"' to element at AndroidManifest.xml:9:5-31:19 to override.

It's a backup rules merging issue with DriveKit SDK rules and your app and/or another external library you use.

To resolve this, update your `AndroidManifest.xml` file:

{% tabs %}
{% tab title="AndroidManifest.xml" %}

```xml
<application
        android:dataExtractionRules="@xml/merged_data_extraction_rules"
        tools:replace="android:dataExtractionRules"
/>        
```

{% endtab %}
{% endtabs %}

Then find the related backup rules of your app or the external library and create the file `merged_data_extraction_rules.xml` in the `src/main/res/xml`folder:

{% tabs %}
{% tab title="merged\_data\_extraction\_rules" %}

```xml
<?xml version="1.0" encoding="utf-8"?>
<data-extraction-rules>
    <!-- Exclude rules of your app and/or the external libraries  -->
    <cloud-backup>
        <exclude domain="sharedpref" path="DriveKitPreferences.xml" />
        <exclude domain="sharedpref" path="DriveKitEncryptedPreferences.xml" />
        <exclude domain="sharedpref" path="DriveKitBackupPrefs.xml" />
        <include domain="sharedpref" path="DriveKitBackup.xml" />
    </cloud-backup>
    <device-transfer>
        <exclude domain="sharedpref" path="DriveKitPreferences.xml" />
        <exclude domain="sharedpref" path="DriveKitEncryptedPreferences.xml" />
        <exclude domain="sharedpref" path="DriveKitBackupPrefs.xml" />
        <include domain="sharedpref" path="DriveKitBackup.xml" />
    </device-transfer>
</data-extraction-rules>
```

{% endtab %}
{% endtabs %}

## `fullBackupContent` property merge issue

If an error message appeared when building your app is something like:

> Error: Attribute application\@fullBackupContent value=(@xml/app\_backup\_exclusion) from \[com.anotherSdk.library:xxx:x.y.z] AndroidManifest.xml:22:18-76 is also present at \[com.drivequant.drivekit:drivekit-core:x.x.x] AndroidManifest.xml:11:9-69 value=(@xml/backup\_rules\_pre\_android\_12). Suggestion: add 'tools:replace="android:fullBackupContent"' to element at AndroidManifest.xml:42:3-72:17 to override.

It's a backup rules merging issue with DriveKit SDK rules and your app and/or another external library you use.

To resolve this, update your `AndroidManifest.xml` file:

{% tabs %}
{% tab title="AndroidManifest.xml" %}

<pre class="language-xml"><code class="lang-xml">&#x3C;application
        android:fullBackupContent="<a data-footnote-ref href="#user-content-fn-1">@xml/merged_backup_rules</a>"
        tools:replace="android:fullBackupContent" 
        (…)
/>
</code></pre>

{% endtab %}
{% endtabs %}

Then find the related backup rules of your app or the external library and create the file `merged_backup_rules.xml` in the `src/main/res/xml`folder:

{% code title="merged\_backup\_rules.xml" fullWidth="false" %}

```xml
<?xml version="1.0" encoding="utf-8"?>
<data-extraction-rules>
	<!-- Exclude rules of your app and/or the external libraries  -->

	<exclude domain="sharedpref" path="DriveKitPreferences.xml" />
	<exclude domain="sharedpref" path="DriveKitEncryptedPreferences.xml" />
	<exclude domain="sharedpref" path="DriveKitBackupPrefs.xml" />
	<include domain="sharedpref" path="DriveKitBackup.xml" />
</data-extraction-rules>
```

{% endcode %}

{% hint style="warning" %}
If you have both **dataExtractionRules** and **fullBackupContent** merge issues, you have to declare the two attrbutes as follows:

```xml
<application
        android:dataExtractionRules="@xml/merged_data_extraction_rules"
        android:fullBackupContent="@xml/merged_backup_rules"
        tools:replace="android:dataExtractionRules, android:fullBackupContent"
        (…)
/>
```

{% endhint %}

## `BackupAgent` merge issue

If an error message appeared when building your app looks like:

> ```xml
> Manifest merger failed : Attribute application@backupAgent value=(com.yourApp.yourClass) from AndroidManifest.xml:9:9-47
> 	is also present at [:Core] AndroidManifest.xml:11:9-86 value=(com.drivequant.drivekit.core.backup.DriveKitBackupAgent).
> 	Suggestion: add 'tools:replace="android:backupAgent"' to <application> element at AndroidManifest.xml:7:5-42:19 to override.
> ```

It's because DriveKit SDK is using the `BackupAgent` to restore some user information when the user has reinstalled the app.&#x20;

DriveKit is providing two ways to handle the error:

### Way 1 - Inherit from `DriveKitBackupAgent`

The easiest way is to make your `BackupAgent` class inherits our `DriveKitBackupAgent` class.

### Way 2 - Call DriveKit backup methods

If you cannot inherit from `DriveKitBackupAgent` class, e.g. when you already inherits from another class, you can still:&#x20;

1. Add `tools:replace="android:backupAgent` in your Manifest as suggested in the error message.
2. Call `DriveKitBackupAgent.onCreate(BackupAgentHelper)` in your overriden `onCreate()` method
3. Call `DriveKitBackupAgent.onRestoreFinished(BackupAgentHelper)` in your overriden `onRestoreFinished()` method

[^1]:
