skip to Main Content

I’m new to react native, and I just built my first mobile app (a simple D&D dice app).
but I’m not able and don’t know how to export it now as an .apk file to install it on my phone.
I’ve used Visual studio code and Expo Go to make and test the app, but now I’m stuck, help would be much appreciated 🙂

I have tried a few youtube tutorials, but I just get a lot of errors

2

Answers


  1. To generate the APK go to the root of the project in the terminal and run the below command:

    react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
    

    Go to android directory:

    cd android
    

    Now in this android folder, run this command

    ./gradlew assembleDebug
    

    You should find the apk file in the following:

    yourProject/android/app/build/outputs/apk/debug/app-debug.apk
    

    The thing is, this will generate a "debug apk" to generate a "Release APK" you will have to setup a signature for the APK, but this is only necessary when publishing to the stores, not to create a debug apk version.

    Login or Signup to reply.
  2. As you have Expo setup use the EAS CLI –

    First, you need to set up the CLI on your PC please follow the steps

    • npm install -g eas-cli
    • eas login
    • eas build:configure

    https://docs.expo.dev/build/setup/

    After that run the cmd as per your required platform-

    eas build –platform android

    or

    eas build –platform ios

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search