wodin
October 23, 2021, 6:03am
7
Ah. For that you’d need a config plugin. And if you’re going to write a config plugin you might as well generate the aid_list.xml
file in that too.
See https://docs.expo.dev/guides/config-plugins/
I believe you want to use withAndroidManifest
.
Clone the https://github.com/expo/expo/
repository and run this to find examples:
git grep -l withAndroidManifest -- packages/*/plugin/src/
Here are some posts on the forums that have examples too (in no particular order):
Hi @yzobairi
Yes, I think you’re right. It looks like the following is missing from android/app/build.gradle:
GIF and WebP support on Android
When building your own native code, GIF and WebP are not supported by default on Android.
You will need to add some optional modules in android/app/build.gradle , depending on the needs of your app.
dependencies {
// If your app supports Android versions before Ice Cream Sandwich (API level 14)
implementation 'com.facebook.fresco:animated-base-sup…
EDIT: I’ve found an easier way to set *SdkVersion without writing your own plugin
Hey @expo_karaushu
I just managed to get this to work! (Android only for now).
This is my first time trying to write my own config plugins, so I’m sure some things could be done better. Also, I don’t like all the manual config.replace(/regex/, string) and the brute force way I’m replacing the packagingOptions, but at least it seems to work!
I only tried building for Android so far and have not actually tested …
Hi
I ran into this error when trying to get an app that uses react-native-ffmpeg to build. I managed to work out how to write a config plugin to resolve this based on @charliecruzan ’s message. My config plugin assumes that there are no other config plugins that are also modifying the packagingOptions in the android/app/build.gradle.
Create a new file with the following contents:
plugins/withAndroidPickFirst.js:
const { withAppBuildGradle, withPlugins } = require("@expo/config-plugins");
fun…
We’ll add the supported list to https://reactnative.directory after we release Expo Dev Clients and have a completed workflow for most managed users to migrate to. Related tweet .
Right now, the supported packages I know of are @react-native-mapbox-gl/maps, react-native-health, @react-native-voice/voice, @stripe/react-native-stripe, and react-native-nfc-manager (like you mentioned). PRs are open for react-native-ble-plx and react-native-webrtc (I’ve also reached out to their respective maintaine…
Editing MainApplication is pretty tough I think…and we’re currently trying to make it so that you don’t need to directly edit this file but instead just extend some interface in your MainApplication. However- the expo-dev-client does this now: expo/withDevLauncher.ts at master · expo/expo · GitHub
SDK Version: 42
Platforms(Android/iOS/web/all): Android
config-plugins mods
For static modifications to AndroidManifest.xml, able to add JSON to mods.android.manifest per default mod vs plugin?
Attempting to add mods: { android: { manifest: { ... } } in app.config.js results in [android.manifest]: withAndroidManifestBaseMod: nextMod is not a function from running expo config --type introspect
Hi everyone,
I have gotten react-native-branch to work on EAS Build and thought I would share my code for others coming after me. A big shout out to @jvincent who is really the person who made this all work first, he helped me through my setup and couldn’t have done it without him.
After setting up EAS Build and for me migrating from expo build, I commented out all my expo-branch code and uninstalled the package. And off I went, instructions are below but a couple of comments before:
The was…
The final plugin (I have not tested this code) may look like this:
//firebase-iid-plugin.js
const expoConfigPlugins = require("@expo/config-plugins");
const firebaseIID = "com.google.firebase:firebase-iid";
const iidVersion = "17.0.2";
function addDependency(buildGradle) {
if (!buildGradle.includes(firebaseIID)) {
// TODO: Find a more stable solution for this
buildGradle = buildGradle.replace(
/dependencies\s?{/,
`dependencies {
implementation '${firebaseIID}:${i…
Try adding this plugin to your project to disable the architectures:
File: withSimulatorExcludedArchitectures.js
const { withXcodeProject } = require('@expo/config-plugins');
/**
* Exclude building for arm64 on simulator devices in the pbxproj project.
* Without this, production builds targeting simulators will fail.
*/
function setExcludedArchitectures(project) {
const configurations = project.pbxXCBuildConfigurationSection();
// @ts-ignore
for (const { buildSettings } of Obje…
Also maybe have a look at xml2js for generating aid_list.xml
.
EDIT: Here’s another example:
import {
ConfigPlugin,
withAndroidManifest,
AndroidConfig,
} from "expo/config-plugins";
type InnerManifest = AndroidConfig.Manifest.AndroidManifest["manifest"];
type ManifestPermission = InnerManifest["permission"];
// TODO: add to `AndroidManifestAttributes` in @expo/config-plugins
type ExtraTools = {
// https://developer.android.com/studio/write/tool-attributes#toolstargetapi
"tools:targetApi"?: string;
};
type ManifestUsesPermissionWithExtraTools = {
$: AndroidConfig.Manifest.ManifestUsesPermission["$"] & ExtraTools;
};
This file has been truncated. show original