Anyone know how to explain the process of generating an apk in React Native

6

I can not in any way generate an apk, I follow the steps of the documentation but soon I can not generate the keytool. Can anyone explain how it is generated?

    
asked by anonymous 23.12.2016 / 16:05

1 answer

6

To generate an apk ~ signed ~ you must first generate the .keystore.

This step is quite simple. Just go to where you put your jdk ( C:\Program Files\Java\jdkx.x.x_x\bin - in this case I did with version jdk1.8.0_92 )

And run, as is here :

$ keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000

So, enter the information you are asking for. The information you will need is: name da keytool (will generate as my-release-key probably) and password .

NOTE: I needed admin permission to generate.

Once you have done this, take the newly generated keytool and put it in android/app in the directory of your React Native project.

Then, add% as_with%:

MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
MYAPP_RELEASE_STORE_PASSWORD=*****
MYAPP_RELEASE_KEY_PASSWORD=*****

After that, modify android/gradle.properties as it says in the React Native tutorial:

...
android {
    ...
    defaultConfig { ... }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }
    buildTypes {
        release {
            ...
            signingConfig signingConfigs.release
        }
    }
}
...

Then just run:

android/app/build.grade $ cd MyAPP/android

Note: I had to put gradlew in the PATH to run the last command.

Your apk will appear in $ gradlew assembleRelease after build .

    
15.03.2017 / 04:13