Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APK build too large #27085

Closed
Elue-dev opened this issue Feb 14, 2024 · 11 comments
Closed

APK build too large #27085

Elue-dev opened this issue Feb 14, 2024 · 11 comments
Labels
Development Builds known issue Known issues that we intend to fix but have no timeline for.

Comments

@Elue-dev
Copy link

Elue-dev commented Feb 14, 2024

Summary

I built my app with the latest version of eas cli for android, its a very small project (for now), but the APK size is extremely high for such a small app (102MB). This has not happened before, the last app i built, which has way more code and more dependencies is not as large as that (35MB). Please what could be the issue, could it be the new expo sdk or what could be the cause of this?

package.json to show my dependencies and their versions:

{
  "name": "my_app",
  "version": "1.0.0",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@expo/config-plugins": "^7.8.4",
    "@react-native-async-storage/async-storage": "^1.21.0",
    "@react-navigation/bottom-tabs": "^6.5.11",
    "@react-navigation/material-top-tabs": "^6.6.6",
    "@react-navigation/native": "^6.1.9",
    "@react-navigation/native-stack": "^6.9.17",
    "@react-navigation/stack": "^6.3.20",
    "@tanstack/react-query": "^5.18.1",
    "axios": "^1.6.7",
    "expo": "~50.0.6",
    "expo-asset": "^9.0.2",
    "expo-barcode-scanner": "~12.9.2",
    "expo-blur": "^12.9.1",
    "expo-camera": "~14.0.4",
    "expo-font": "^11.10.2",
    "expo-haptics": "^12.8.1",
    "expo-image": "~1.10.6",
    "expo-linear-gradient": "~12.7.1",
    "expo-linking": "~6.2.2",
    "expo-notifications": "~0.27.6",
    "expo-splash-screen": "^0.26.4",
    "expo-status-bar": "~1.11.1",
    "expo-system-ui": "^2.9.3",
    "expo-updates": "~0.24.10",
    "lottie-react-native": "6.5.1",
    "nativewind": "^2.0.11",
    "react": "18.2.0",
    "react-native": "0.73.4",
    "react-native-gesture-handler": "~2.14.0",
    "react-native-pager-view": "^6.2.3",
    "react-native-paper": "^5.12.3",
    "react-native-reanimated": "~3.6.2",
    "react-native-reanimated-carousel": "^3.5.1",
    "react-native-safe-area-context": "4.8.2",
    "react-native-screens": "^3.29.0",
    "react-native-shared-element": "^0.8.9",
    "react-native-svg": "^14.1.0",
    "react-native-swiper": "^1.6.0",
    "tailwindcss": "^3.3.2"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@types/react": "~18.2.45",
    "react-native-svg-transformer": "^1.3.0",
    "typescript": "^5.1.3"
  },
  "private": true
}

Managed or bare workflow?

managed

What platform(s) does this occur on?

Android

Package versions

my eas.json:

{
  "cli": {
    "version": ">= 7.2.0"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal",
      "android": {
        "image": "latest",
        "gradleCommand": ":app:assembleDebug"
      },
      "ios": {
        "image": "latest",
        "buildConfiguration": "Debug"
      }
    },
    "preview": {
      "channel": "production",
      "distribution": "internal",
      "ios": {
        "simulator": true
      }
    },
    "production": {
      "channel": "production",
      "android": {
        "image": "latest",
        "buildType": "apk"
      },
      "ios": {
        "image": "latest"
      }
    }
  },
  "submit": {
    "production": {
      "ios": {
      }
    }
  }
}

dependencies:

{
  "name": "tcnjoinup",
  "version": "1.0.0",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@expo/config-plugins": "^7.8.4",
    "@react-native-async-storage/async-storage": "^1.21.0",
    "@react-navigation/bottom-tabs": "^6.5.11",
    "@react-navigation/material-top-tabs": "^6.6.6",
    "@react-navigation/native": "^6.1.9",
    "@react-navigation/native-stack": "^6.9.17",
    "@react-navigation/stack": "^6.3.20",
    "@tanstack/react-query": "^5.18.1",
    "axios": "^1.6.7",
    "expo": "~50.0.6",
    "expo-asset": "^9.0.2",
    "expo-barcode-scanner": "~12.9.2",
    "expo-blur": "^12.9.1",
    "expo-camera": "~14.0.4",
    "expo-font": "^11.10.2",
    "expo-haptics": "^12.8.1",
    "expo-image": "~1.10.6",
    "expo-linear-gradient": "~12.7.1",
    "expo-linking": "~6.2.2",
    "expo-notifications": "~0.27.6",
    "expo-splash-screen": "^0.26.4",
    "expo-status-bar": "~1.11.1",
    "expo-system-ui": "^2.9.3",
    "expo-updates": "~0.24.10",
    "lottie-react-native": "6.5.1",
    "nativewind": "^2.0.11",
    "react": "18.2.0",
    "react-native": "0.73.4",
    "react-native-gesture-handler": "~2.14.0",
    "react-native-pager-view": "^6.2.3",
    "react-native-paper": "^5.12.3",
    "react-native-reanimated": "~3.6.2",
    "react-native-reanimated-carousel": "^3.5.1",
    "react-native-safe-area-context": "4.8.2",
    "react-native-screens": "^3.29.0",
    "react-native-shared-element": "^0.8.9",
    "react-native-svg": "^14.1.0",
    "react-native-swiper": "^1.6.0",
    "tailwindcss": "^3.3.2"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@types/react": "~18.2.45",
    "react-native-svg-transformer": "^1.3.0",
    "typescript": "^5.1.3"
  },
  "private": true
}

Environment

expo-env-info 1.2.0 environment info:
System:
OS: macOS 12.7.2
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 20.11.0 - /usr/local/bin/node
npm: 10.3.0 - /usr/local/bin/npm
Managers:
CocoaPods: 1.14.3 - /Users/nubiaville/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
IDEs:
Android Studio: 2023.1 AI-231.9392.1.2311.11255304
Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
npmPackages:
expo: ~50.0.6 => 50.0.6
react: 18.2.0 => 18.2.0
react-native: 0.73.4 => 0.73.4
npmGlobalPackages:
eas-cli: 7.2.0
expo-cli: 6.3.10
Expo Workflow: bare

Reproducible demo

Link to the repository:
https://github.com/Elue-dev/TCN-Church-App

Stacktrace (if a crash is involved)

No response

@Elue-dev Elue-dev added Development Builds needs validation Issue needs to be validated labels Feb 14, 2024
@expo-bot expo-bot added needs review Issue is ready to be reviewed by a maintainer and removed needs validation Issue needs to be validated labels Feb 14, 2024
@benjaminkomen
Copy link
Contributor

Known issue, see this explanation.

@Elue-dev
Copy link
Author

Known issue, see this explanation.

very helpful, thank you

@Kudo Kudo added known issue Known issues that we intend to fix but have no timeline for. and removed needs review Issue is ready to be reviewed by a maintainer labels Feb 20, 2024
@Kudo Kudo closed this as completed Feb 20, 2024
@Jonak-Adipta-Kalita
Copy link

Jonak-Adipta-Kalita commented Apr 27, 2024

gosh I am having the same problem lol, my apk size went from ≈ 45MB to ≈ 100MB

@abdulragib
Copy link

I don't like expo , just leave it , use react native cli

@Elue-dev
Copy link
Author

Elue-dev commented May 1, 2024

gosh I am having the same problem lol, my apk size went from ≈ 45MB to ≈ 100MB

to reduce the size, run a prebuild, npx expo prebuild -p android, then open grade.properties file, go to the very last property, expo.useLegacyPackaging, and change it from false to true, then run the command to generate your APK

@Jonak-Adipta-Kalita
Copy link

@Elue-dev I used APK just to test something, I will use AAB anyway, which isnt affected in the new sdk!

@Devdannnny
Copy link

useLegacyPackaging

This solution works for me

@Naveen-Prasanth-K
Copy link

gosh I am having the same problem lol, my apk size went from ≈ 45MB to ≈ 100MB

to reduce the size, run a prebuild, npx expo prebuild -p android, then open grade.properties file, go to the very last property, expo.useLegacyPackaging, and change it from false to true, then run the command to generate your APK

This is working for me.

@Vignesh2828
Copy link

gosh I am having the same problem lol, my apk size went from ≈ 45MB to ≈ 100MB

to reduce the size, run a prebuild, npx expo prebuild -p android, then open grade.properties file, go to the very last property, expo.useLegacyPackaging, and change it from false to true, then run the command to generate your APK

Wow, thank you man this is working for me 75mp to 34mp

@AsianManiac
Copy link

gosh I am having the same problem lol, my apk size went from ≈ 45MB to ≈ 100MB

to reduce the size, run a prebuild, npx expo prebuild -p android, then open grade.properties file, go to the very last property, expo.useLegacyPackaging, and change it from false to true, then run the command to generate your APK

It worked for me as well. Thank you very much. I often get errors when I do a prebuild and try to run the app but I did a prebuild and just ran the eas command and my apk came down from = 90MB to = 45MB.

@maipato10
Copy link

npx expo prebuild -p android

@Naveen-Prasanth-K your solution worked for me as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development Builds known issue Known issues that we intend to fix but have no timeline for.
Projects
None yet
Development

No branches or pull requests