How to reduce the size of an expo/react-native app on Android
For android APK bundle using expo, you can use the following command:
expo build:android -t app-bundle
The size will be much smaller once you upload it to the play store. This is relevant for React Native SDK 32 and earlier.
the expo is for development the app you should migrate to react-native for production
make a new react app "
react-native init
"Copy the source files over from Expo project
Install all dependencies of the Expo project except Expo specific libraries.
Make necessary adjustments to
app.json
fileDownload the signing key of your Android app from Expo using exp
fetch:android:keystore and set it up
This reduces your app dramatically you can also enable proguard and specific build for cpu architecture
buildTypes {
release {
debuggable false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
for more info visit https://medium.com/@aswinmohanme/how-i-reduced-the-size-of-my-react-native-app-by-86-27be72bba640
using expo component
after you done and want publish with less size or just wan't to use a native library expo give you an option called ExpoKit this also can be used with already build with native code react projects
1-run command expo eject
to add ExpoKit (choose the "ExpoKit" option)
(no need to do this if you have copied files manually or using native project)
2 -start expo packager with expo start
.Leave this running and continue with the following steps.
3-
link library for android and ios, this command mostly do this react-native link
, sometime this will not work and you should do it manually for this means visit expokit
PS: I didn't test this so if this not work inform me