react-nativeexpo

How to reduce the size of an expo/react-native app on Android


I am developing a small dictionary app by using react native with expo.

As I am compiling to Apk file. The size goes up to 30mb and after having installed on a device, it goes to 80mb.

Is this normal?

Are there any ways to reduce the size of the app?

Thank you guys.


Solution

  • the expo is for development the app you should migrate to react-native for production



    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