Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 919
Md Aman Khan Avatar asked Sep 18 '25 09:09

Md Aman Khan


1 Answers

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

like image 79
Pruthviraj Lakhara Avatar answered Sep 19 '25 23:09

Pruthviraj Lakhara