Skip to content

Instantly share code, notes, and snippets.

@djaffer
Last active December 2, 2025 13:05
Show Gist options
  • Select an option

  • Save djaffer/92260b643bd6e090b1d13291a7192a43 to your computer and use it in GitHub Desktop.

Select an option

Save djaffer/92260b643bd6e090b1d13291a7192a43 to your computer and use it in GitHub Desktop.
Modifying Android Manifest Attributes for Expo
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;
});
};
@summerkiflain
Copy link

👍

@anhtuan219
Copy link

@djaffer It's working great. Thank you so much!!

@diceros-soojungkim
Copy link

diceros-soojungkim commented Aug 29, 2024

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