How do I create an Apk with react native?


#1

The docs at https://facebook.github.io/react-native/docs/running-on-device.html make no mention of installing the android sdk. It simply states I should get the adb which I got from developer.android.com/studio/releases/platform-tools.html. now when I try this:

C:\Users\username\Documents\host\Node\worship_app>adb install com.app_name PACKAGE

I get the error "adb: usage: need APK file on command line". So I try the react native route instead with

react-native start

which outputs one message forever: "Loading dependency graph, done."

So I go to another cli window and enter
react-native run-android

After saving the file local.properties in the android subfolder. That's when I get the error " The SDK directory 'C:\Users\nmeri17\AppData\Local\Android\sdk' does not exist.", which in all fairness does not exist. I guess it should be there if I've got android sdk installed but since it's not in the docs, I'm guessing there's another way to go about it. I've squandered all my bandwidth on this folder they downloaded when I ran react-native run-android the 1st time; I was redirected to http://services.gradle.org/distributions/. The folder is still there along with the unpacked zip, along with the thousands of dependencies they also downloaded when I ran create-react-native-app AwesomeProject. I realized what was happening to my bandwidth very late and shut it down but most of the files are still there. Can they be of any use to me? I just want to package the snippets from https://reactnavigation.org/docs/intro/quick-start, setup, see what it looks like and start my personal project based on what I've studied. Is there no way to achieve this without installing the gigantic sdk (which i can't even afford)? Many thanks.


#2

Hi There!,

I hope you already solved your problem :slight_smile:

But if not yet here I can help you..follow this to make Signed APK

After you generate the .keystore it is located in C:\Users\yourusername

After that navigate to android folder of your project
cd android
then issue this command ./gradlew clean && ./gradlew assembleRelease

your release apk will be place here android\app\build\outputs\apk

take note if you see this app-release-unsigned.apk this will not install, it should be
app-release.apk

Hope it helps :slight_smile:


#3

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.