adaptyteam / AdaptySDK-Flutter

SDK for growing mobile in-app purchases
https://docs.adapty.io/docs/quickstart
MIT License
95 stars 17 forks source link

Android Manifest conflict with AppsFlyer (backup rules) #58

Closed guilhermeagostinelli closed 1 year ago

guilhermeagostinelli commented 2 years ago

Hello,

I'm experiencing the following error when trying to execute the app:

/home/guilherme/Desktop/Positiv/mobile_app/android/app/src/debug/AndroidManifest.xml:12:18-70 Error:
    Attribute application@fullBackupContent value=(@xml/adapty_backup_rules) from [com.github.adaptyteam:AdaptySDK-Android:1.11.0] AndroidManifest.xml:12:18-70
    is also present at [com.appsflyer:af-android-sdk:6.8.2] AndroidManifest.xml:15:18-73 value=(@xml/appsflyer_backup_rules).
    Suggestion: add 'tools:replace="android:fullBackupContent"' to <application> element at AndroidManifest.xml:31:5-168:19 to override.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Manifest merger failed : Attribute application@fullBackupContent value=(@xml/adapty_backup_rules) from [com.github.adaptyteam:AdaptySDK-Android:1.11.0] AndroidManifest.xml:12:18-70
    is also present at [com.appsflyer:af-android-sdk:6.8.2] AndroidManifest.xml:15:18-73 value=(@xml/appsflyer_backup_rules).
    Suggestion: add 'tools:replace="android:fullBackupContent"' to <application> element at AndroidManifest.xml:31:5-168:19 to override.

Related:

By taking a look at https://github.com/AppsFlyerSDK/appsflyer-android-sdk/issues/9#issuecomment-760150089 and https://github.com/adaptyteam/AdaptySDK-Android/blob/master/adapty/src/main/res/xml/adapty_backup_rules.xml I have managed to solve it by:

  1. Creating a backup_rules.xml file in android/app/src/main/res/xml with the following content:
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
    <exclude domain="sharedpref" path="appsflyer-data"/>
    <exclude domain="sharedpref" path="AdaptySDKPrefs.xml"/>
</full-backup-content>
  1. Adding the following two lines to the application tag of my AndroidManigest file:
android:fullBackupContent="@xml/backup_rules"
tools:replace="android:fullBackupContent"

Even though it works, I would like to confirm if this is the right approach and if it won't cause any side effects on the integration with Adapty and on the data being collected.

vladd-g commented 2 years ago

@guilhermeagostinelli yes, looks like ok, it won't affect the integration with Adapty

guilhermeagostinelli commented 2 years ago

Ok, thank you @vladd-g ! I guess it would be nice to mention this somewhere in the Adapty documentation.

Please feel free to close this issue.