Forked from djaffer/modifyAndroidManifestAttributes.js
Created
August 10, 2025 16:40
-
-
Save m-cakir/f163418d9c0f316844b42bdef5f314bc to your computer and use it in GitHub Desktop.
Modifying Android Manifest Attributes for Expo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { withAndroidManifest } = require('@expo/config-plugins'); | |
| /** | |
| Usage: | |
| 1. Create a dir named plugins at root of project where app.json is located | |
| 1. Add this file to your project (eg: ./plugins/modifyAndroidManifestAttributes.js) | |
| 2. In app.json use add this under expo attribute: | |
| "expo"{ | |
| ..., | |
| "plugins": [ | |
| [other plugin 1 ], | |
| [other plugin 2], | |
| [ | |
| "./plugins/modifyAndroidManifestAttributes", | |
| { | |
| "application": { | |
| "android:hardwareAccelerated": "true", | |
| "android:largeHeap": "true" | |
| } | |
| } | |
| ] | |
| ] | |
| } | |
| 3. Build your Expo App using EAS Build | |
| 4. To test/debug you can do locally with console.log by using npx expo prebuild | |
| **/ | |
| module.exports = function androidManifestPlugin(config, data) { | |
| return withAndroidManifest(config, async (config) => { | |
| let androidManifest = config.modResults.manifest; | |
| const categories = Object.keys(data); | |
| categories.forEach((category) => { | |
| if ( | |
| androidManifest[category] && | |
| Array.isArray(androidManifest[category]) && | |
| androidManifest[category].length > 0 | |
| ) { | |
| const attributes = Object.keys(data[category]); | |
| attributes.forEach((attribute) => { | |
| androidManifest[category][0].$[attribute] = data[category][attribute]; | |
| }); | |
| } | |
| }); | |
| return config; | |
| }); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment