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

Build fail with new React Native (0.76) and Expo SDK 52 #586

Open
fkrein1 opened this issue Nov 13, 2024 · 5 comments
Open

Build fail with new React Native (0.76) and Expo SDK 52 #586

fkrein1 opened this issue Nov 13, 2024 · 5 comments

Comments

@fkrein1
Copy link

fkrein1 commented Nov 13, 2024

Report

Plugin Version

6.15.1

On what Platform are you having the issue?

Android, React Native 0.76 and Expo SDK 52

What did you do?

expo run:android

What did you expect to happen?

Build successful after upgrading from 0.74 to 0.76

What happened instead?

Build failed

Please provide any other relevant information.

Build Error Log

Task :app
FAILED /Users/fk/peer/code-review/peerbr-mobile/android/app/src/debug/AndroidManifest.xml:19:307-376 Error: Attribute application@dataExtractionRules value=(@xml/secure_store_data_extraction_rules) from AndroidManifest.xml:19:307-376 is also present at [com.appsflyer:af-android-sdk:6.15.1] AndroidManifest.xml:42:9-75 value=(@xml/appsflyer_data_extraction_rules). Suggestion: add 'tools
="android
"' to element at AndroidManifest.xml:6:5-162 to override. /Users/fk/peer/code-review/peerbr-mobile/android/app/src/debug/AndroidManifest.xml:19:248-306 Error: Attribute application@fullBackupContent value=(@xml/secure_store_backup_rules) from AndroidManifest.xml:19:248-306 is also present at [com.appsflyer:af-android-sdk:6.15.1] AndroidManifest.xml:43:9-64 value=(@xml/appsflyer_backup_rules). Suggestion: add 'tools
="android
"' to element at AndroidManifest.xml:6:5-162 to override.

less
Copy code

@akilamist
Copy link

@fkrein1 any update on this ? having same issue

@akilamist
Copy link

akilamist commented Nov 13, 2024

just found solution if you are running on Expo follow this steps

create withCustomAndroidManifest inside root of your project

// withCustomAndroidManifest.js
const { withAndroidManifest } = require('@expo/config-plugins');

module.exports = function withCustomAndroidManifest(config) {
  return withAndroidManifest(config, async (config) => {
    const androidManifest = config.modResults;
    const manifest = androidManifest.manifest;
    
    // Ensure xmlns:tools is present in the <manifest> tag
    if (!manifest.$['xmlns:tools']) {
      manifest.$['xmlns:tools'] = 'http://schemas.android.com/tools';
    }

    const application = manifest.application[0];

    // Add tools:replace attribute for dataExtractionRules and fullBackupContent
    application['$']['tools:replace'] = 'android:dataExtractionRules, android:fullBackupContent';

    // Set dataExtractionRules and fullBackupContent as attributes within <application>
    application['$']['android:dataExtractionRules'] = '@xml/secure_store_data_extraction_rules';
    application['$']['android:fullBackupContent'] = '@xml/secure_store_backup_rules';

    return config;
  });
};

Add the Custom Plugin to app.json: Modify app.json to include the new custom plugin:

{
  "expo": {
    ...
    "plugins": [
      "./withCustomAndroidManifest",
      ...
    ]
  }
}

run prebuild and Manifest.xml will be changed

if you are on bare react native project just add these to Manifest XML

tools:replace="android:dataExtractionRules, android:fullBackupContent"

@fkrein1
Copy link
Author

fkrein1 commented Nov 13, 2024

@akilamist thanks! It worked here as well.
I hope AppsFlyerSDK adds this config change to their plugin in a new release.

@dr0l3
Copy link

dr0l3 commented Dec 5, 2024

@al-af

Maybe instead of just closing this you could integrate it into the SDK or at the very least add this to the docs. Would have saved me a quite a few hours of work. Its a legitimate issue that I am pretty sure everyone will hit if they are using recent versions.

@younes200
Copy link

Why is this closed, @al-af?

@al-af al-af reopened this Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants