2

I have started learning react native. I have built a demo app. I want to make a release build and install the apk in my physical device. Can anyone please provide any documentation regarding how to build an apk in react native?

  • https://stackoverflow.com/questions/35935060/how-can-i-generate-an-apk-that-can-run-without-server-with-react-native or https://stackoverflow.com/questions/59528262/generate-release-apk-in-react-native – Suraj Rao May 29 '22 at 12:07
  • 1
    Does this answer your question? https://stackoverflow.com/questions/71450050/cant-get-rest-api-requests-to-work-on-deployment-device-with-react-native/71450349#71450349 – Tafsir Ahamed May 29 '22 at 12:26

1 Answers1

1

For building the app you need to follow this answer from this thread: How can I generate an apk that can run without server with react-native? In this thread there is not specified to add a file named local.properties in your /android, there you need to set your SDK location. Just like this:

sdk.dir = C:\\Users\\USERNAME\\AppData\\Local\\Android\\sdk

For installing the app you need to install ADB, follow this tutorial: https://developer.android.com/studio/command-line/adb

Don't forget to add the location where you installed the files to environment variables ( on Windows ).

Now you can use adb commands, so connect your device by usb cable.

On your phone, turn on Developer Options and activate USB debugging.

After this go to the location /android/app/build/outputs/apk/release inside your react-native project and run this: adb install app-release.apk

Now your app is installed on your device =)

More of this you can find in tutorials, there are many of them.