Last active
December 2, 2025 13:05
-
-
Save djaffer/92260b643bd6e090b1d13291a7192a43 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; | |
| }); | |
| }; |
@djaffer It's working great. Thank you so much!!
thank you so much, my build just kept on crashing because of memory leak... I hope this works!!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍