Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Manifest merge conflict (backup rules) #9

Closed
ljwan12 opened this issue Jan 14, 2020 · 15 comments
Closed

Android Manifest merge conflict (backup rules) #9

ljwan12 opened this issue Jan 14, 2020 · 15 comments

Comments

@ljwan12
Copy link

ljwan12 commented Jan 14, 2020

tools:replace specified at line:20 for attribute android:fullBackupContent, but no new value specified

@ljwan12
Copy link
Author

ljwan12 commented Jan 14, 2020

  • What went wrong:
    Execution failed for task ':android:processReleaseManifest'.

Manifest merger failed : Attribute application@fullBackupContent value=(@xml/vungle_backup_rule) from [com.vungle:publisher-sdk-android:6.4.11] AndroidManifest.xml:19:9-60
is also present at [com.appsflyer:af-android-sdk:4.11.0] AndroidManifest.xml:14:18-73 value=(@xml/appsflyer_backup_rules).
Suggestion: add 'tools:replace="android:fullBackupContent"' to element at AndroidManifest.xml:19:5-95:19 to override.

@ljwan12 ljwan12 changed the title tools:replace specified at line:20 for attribute android:fullBackupContent, but no new value specified Help Jan 14, 2020
@elitvynov
Copy link

  • What went wrong:
    Execution failed for task ':android:processReleaseManifest'.

Manifest merger failed : Attribute application@fullBackupContent value=(@xml/vungle_backup_rule) from [com.vungle:publisher-sdk-android:6.4.11] AndroidManifest.xml:19:9-60
is also present at [com.appsflyer:af-android-sdk:4.11.0] AndroidManifest.xml:14:18-73 value=(@xml/appsflyer_backup_rules).
Suggestion: add 'tools:replace="android:fullBackupContent"' to element at AndroidManifest.xml:19:5-95:19 to override.

Did you find any solution? I have this problem too

@elitvynov
Copy link

Add to
  <application
tools: replace = "android: fullBackupContent"
         android: allowBackup = "true"
         android: fullBackupContent = "true"

This is working, thank you

@syrakozz
Copy link

syrakozz commented May 3, 2020

but it takes forever while building

@Cotel
Copy link

Cotel commented May 8, 2020

I'm having a similar issue 😢

Execution failed for task ':dynamicModuleMaps:processDebugAndroidTestResources'.
AAPT: error: resource xml/appsflyer_backup_rules not found

In the main manifest allowBackup is set to false. The task is failing for a dynamic module.

@ManakaMichihito
Copy link

I have the same problem.

I found below:
#3

fullBackupContent is not only used by AppsFlyer.
There is also a library that dynamically sets fullBackupContent just like AppsFlyer.
We cannot always do a manual merge!!!

@lfg-ryan
Copy link

I have the same problem. Vungle is also using this and I can't tell how to merge them in Unity when all of this is auto-generated stuff.

@ManakaMichihito
Copy link

AppsFlyer support only answers manual merges, no matter how many times we explain it, it doesn't fix the issue...

@ManakaMichihito
Copy link

ManakaMichihito commented May 22, 2020

They don't seem to present anything other than manually merging AndroidManifext.xml.
The answer was an inquiry to Unity technologies.

tools: replace = "android: fullBackupContent"
If there is a person to go and solve

Is required:
android:fullBackupContent="true"
&
AppsFlyer's FullBackup rules
(XML : full-backup-content tag)

They said:
"We have to do this in order to do the attribution and tracking accurately, if not, the reinstall will always retrieve the old install data which should be deleted."

@VladimirKuzmin-azur
Copy link

VladimirKuzmin-azur commented Jul 14, 2020

android:fullBackupContent="@xml/appsflyer_backup_rules" tools:replace="android:fullBackupContent
This works just fine for me. Mediation Debugger also shows that Vungle if fine. But I am little worried for Vungle backup-ing.
Could some android sensei tell if this is fine solution or not?
p.s. doing this from Unity's main manifest

@m-kul
Copy link

m-kul commented Jan 8, 2021

Add to
  <application
tools: replace = "android: fullBackupContent"
         android: allowBackup = "true"
         android: fullBackupContent = "true"

This is working, thank you

Can anybody clarify, in which manifest file we need to add this? I cannot find appsflyer's manifest file.

@sokoloff06
Copy link
Contributor

Hi everyone!

We see that this issue is indeed confusing and would like to elaborate a bit extra on this matter.

TL;DR

  • If you don't want Auto Backup - just set android:allowBackup="false" in AndroidManifest and you are good to go
  • If you want Auto Backup - you have to:
  1. Manually merge backup rules from conflicting SDKs such as Vungle and AppsFlyer (there could be more) into your own XML file (e.g. @xml/merged_backup_rules).
  2. Specify this file by setting 2 attributes in AndroidManifest:
    • android:fullBackupContent="@xml/merged_backup_rules" (to use your own rules)
    • tools:replace="android:fullBackupContent" (to give your rules higher priority than rules from any SDK) in AndroidManifest

Some background:
Since Android 6.0 (API level 23) Android has an Auto Backup feature that will back up the app's data into Google Drive every now and then automatically. This is enabled by default but may cause problems to some service providers like AppsFlyer and Vungle. The reason is that we save some data into SharedPreferences which are being backed up by Android, but we don't expect this data to retain between installs. If this data is restored after the user reinstalls the app, we may report attribution for this app incorrectly. I assume, Vungle SDK has some similar challenges.

Since AppsFlyer uses AAR to distribute the library, together with the library jar we package AndroidManifest in which we specify backup rules that are important for our SDK to function properly. Unfortunately, Android as of today doesn't have a solid merge mechanism so in case you have 2 libraries with conflicting values for the same attribute in AndroidManifest you get different kinds of merging conflict errors.

The only solution we can see for now without harming other SDKs is to merge such conflicts manually

Here you can find Vungle backup rules - https://support.vungle.com/hc/en-us/articles/360047780372#vungle-exclusion-rules-0-11
Here are AppsFlyer backup rules - https://support.appsflyer.com/hc/en-us/articles/207032126-Android-SDK-integration-for-developers#integration-backup-rules

As a result you should have this file with merged rules:

<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
        <exclude domain="sharedpref" path="appsflyer-data"/>
        <exclude domain="file" path="vungle" />
        <exclude domain="file" path="vungle_cache" />
        <exclude domain="external" path="vungle_cache" />
        <exclude domain="database" path="vungle_db" />
        <exclude domain="sharedpref" path="com.vungle.sdk.xml" />
</full-backup-content>

@sokoloff06 sokoloff06 changed the title Help Android Manifest merge conflict (backup rules) Jan 14, 2021
@sokoloff06 sokoloff06 pinned this issue Apr 22, 2021
@trickeyd
Copy link

trickeyd commented Jul 19, 2022

Im getting the same issue with Instabug - does anyone have any idea what merge rules may look like for that?

EDIT - answer is here:
Instabug/Instabug-React-Native#738

@emartynov
Copy link

Do you guys support Android 12 and 13? I mean, you should probably include android:dataExtractionRules to SDK.

@h3nr1ke
Copy link

h3nr1ke commented Sep 13, 2023

Just sharing my case here hoping to help anyone in the future that is trying to TURN OFF the backup

I am using the Flutter SDK and it gives me the same problem, since the fix is inside AndroidManifest.xml it may be useful here as well.

If you have some doubts on where to add the extra configurations inside the AndroidManifest.xml, here is a practical example of it

Important points:

  • the file I had to edit was the android/app/src/main/AndroidManifest.xml

  • you must add into the first <manifest> tag (the one that wraps every other tag inside the file) the following

xmlns:tools="http://schemas.android.com/tools"

so your first <manifest> tag will be like this

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.your.collest.app.bundle.id"
    xmlns:tools="http://schemas.android.com/tools"
    >
  • them you need to add inside <application> tag the following
tools:replace="android:fullBackupContent"
android:fullBackupContent="false"
android:allowBackup="false"

so your <application> tag will be like this

 <application
        tools:replace="android:fullBackupContent"
        android:fullBackupContent="false"
        android:allowBackup="false"
        android:label="COOLEST APP LABEL"
        android:name="${applicationName}"
        android:networkSecurityConfig="@xml/network_security_config"
        android:requestLegacyExternalStorage="true"
        android:icon="@mipmap/launcher_icon"
        >

your file may have different option, don't copy and paste it to your project directly

The final file looks like this

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.your.collest.app.bundle.id"
    xmlns:tools="http://schemas.android.com/tools"
    >

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />

    <application
        tools:replace="android:fullBackupContent"
        android:fullBackupContent="false"
        android:allowBackup="false"
        android:label="COOLEST APP LABEL"
        android:name="${applicationName}"
        android:networkSecurityConfig="@xml/network_security_config"
        android:requestLegacyExternalStorage="true"
        android:icon="@mipmap/launcher_icon"
        >

        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>

again... don't just copy and paste this code, its an example and you configurations are probably different.

after do that I was able to build the application once again =)

Hope it helps =)

aliraiki added a commit to pass-culture/pass-culture-app-native that referenced this issue Jun 25, 2024
aliraiki added a commit to pass-culture/pass-culture-app-native that referenced this issue Jun 27, 2024
aliraiki added a commit to pass-culture/pass-culture-app-native that referenced this issue Jun 28, 2024
aliraiki added a commit to pass-culture/pass-culture-app-native that referenced this issue Jun 28, 2024
* (PC-30240) feat(appsflyer): Update lib

* (PC-30240) chore(appsflyer): Update mocks

* (PC-30240) fix(android): Fix debug build

AppsFlyerSDK/appsflyer-android-sdk#9 (comment)

* (PC-30240) feat(useTrackingConsent): Always call callback

* (PC-30240) refactor(ATT): Remove unnecessary hook

* (PC-30240) refactor(ATT): Rename and test function

* (PC-30240) feat(appsflyer): Store user consent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests