Md Aman Khan
Md Aman Khan

Reputation: 56

How to generate apk of react native app without Android Studio

I have developed a react native app without installing Android Studio. Though I have installed some tools which were absolutely needed for the development.

My Android folder structure is something like this:

Android
   .temp
   build-tools
   cmdline-tools
   emulator
   licences
   patcher
   platforms
   platform-tools
   tools
   .knownPackages

Now that I have completed making my app with react native, I want to build an apk (valid and signed) of that and upload it to google drive as of now and share it with my friends, But the problem is, my potato cannot support Android Studio

I could have used expo, but everyone who wants to install my app will have to install expo client app first which is a problem

I hope my sisters and brothers will help me, I am completely new to android-development.

Thanks.

EDIT:-

I was using a real android device for development till now

Upvotes: 4

Views: 6285

Answers (2)

Pruthviraj Lakhara
Pruthviraj Lakhara

Reputation: 51

This solution is for React-Native CLI , don't know it will work with EXPO.

first generate keystore file using in terminal go to java bin folder and then run this keytool -genkeypair -v -keystore my-upload-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000

after that paste that generated keystore file in your android app folder

after that you have to add configuration in your gradlw.properties file

MYAPP_UPLOAD_STORE_FILE=my-upload-key.keystore
MYAPP_UPLOAD_KEY_ALIAS=my-key-alias
MYAPP_UPLOAD_STORE_PASSWORD=*****
MYAPP_UPLOAD_KEY_PASSWORD=*****

and also change in app/build.gradle file :

...
android {
    ...
    defaultConfig { ... }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
                storeFile file(MYAPP_UPLOAD_STORE_FILE)
                storePassword MYAPP_UPLOAD_STORE_PASSWORD
                keyAlias MYAPP_UPLOAD_KEY_ALIAS
                keyPassword MYAPP_UPLOAD_KEY_PASSWORD
            }
        }
    }
    buildTypes {
        release {
            ...
            signingConfig signingConfigs.release
        }
    }
}
...

then

$ cd android
$ ./gradlew bundleRelease

for better guidence visit : https://reactnative.dev/docs/signed-apk-android

Upvotes: 3

Mehroze Yaqoob
Mehroze Yaqoob

Reputation: 1041

If you are using Expo managed flow then you dont need any IDE for build creation, not even macOS machine for ipa, just couple of commands and your build will be ready in 30 min depending upon queue on turtle server.

If you are working with bareflow or React CLI then. you will. be needing assistance of IDE for build creation of both platforms and mac machine for iOS.

For help on commands for build creation on expo managed flow, use this link

Creating android build from Android studio, you can take help from here

Regarding your concern related to build sharing, expo gives you a link from where people can download the APK or IPA. That would ease out the problem related to build sharing

Upvotes: 2

Related Questions