Add reactNativeArchitecture support in expo-build-properties
complete
Kim Brandwijk
complete
You can already use the environment variable
ORG_GRADLE_PROJECT_reactNativeArchitectures
to set the architectures you want to build. You can use that locally for a local build, or in your build profile for EAS Build.This is a better option than potentially being able to set it through the config plugin, as the config plugin applies to all build variants.
theo
Kim Brandwijk: please can you provide a link to the doc? I didn't find the property in expo build properties page
Wodin
theo: This is not an Expo thing, but a Gradle thing. The documentation is here:
See the "Setting a project property via an environment variable" section.
theo
Wodin: I'm using EAS manage workflow with config plug-ins, how can I activate this option in my project? I think we have to configure it in build properties or app.json
Wodin
theo: No, you need to set the environment variable when building. So if you build locally (e.g. with
eas build --local
), you will need to set the environment variable on your local machine.e.g.:
If your dev machine is running macOS or Linux:
ORG_GRADLE_PROJECT_reactNativeArchitectures="arm64-v8a" eas build -p android --profile preview --local
If your dev machine is running Windows:
npx cross-env ORG_GRADLE_PROJECT_reactNativeArchitectures="arm64-v8a" eas build -p android --profile preview --local
If you build on the EAS Build servers, then you should set it in
eas.json
.theo
Wodin: alright thank you
Kim Brandwijk
under review
Ka Tsun Chan
yeah, when splitting it into arm64-v8a only for 64 bits device can significantly reduce bundle size.
Current it exports as 4 architectures which wasted extra spaces for most devices (arm64-v8a)
Wodin
Could you elaborate on what this should do and how it would minimize the app size?
Ka Tsun Chan
Wodin: So that we can generate to one architecture only instead of 4x.
Wodin
Ka Tsun Chan: My understanding is that for Android, as long as you submit a
.aab
file to the Play Store instead of a .apk
, the correct architecture is sent to the phone when the app is downloaded. I don't know how it works with iOS apps. Doesn't it work similarly?Ka Tsun Chan
Wodin: it doesnt have to work with iOS, just give a better control of exported architecture when we are going to export as apk files
Wodin
Ka Tsun Chan: OK, but what I'm saying is that if you upload a
.aab
file to Google Play, then when a device downloads the app, Google Play will send only the relevant architecture to the device. Isn't that sufficient?Rajendran Nadar
Wodin: That will be helpful for debug builds, to build and send for testing to QA without sending to the play store, + we can track the build size before shipping to the store
When we use packages like OCR & Video call the build size increases