How to use Android Studio to pack react Native APK

Source: Internet
Author: User

Ok! Baidu came out of something very miscellaneous, so, here is the simplest, the most suitable for us (novice, should be) apk packaging way!

Of course! This package is based on Android studio, so pay attention!!!!

No more nonsense.

First of all, we want to tidy up our ideas, the first step is to sign the APK ~ The second step is to complete the packaging

First step: Signature

Open Android Studio and then in the menu bar of Build-->generate signed APK in the Open interface click Next, will pop up the following interface

Then click Create New in the pop-up screen to select the location, name, password to fill in the secret key. Also write the name of the alias, the owner of the certificate, the country, the organization, and the information about the city.

Note: The name of our app here is JD, alias is Jd_alias, the name of the password and alias password are the same

Click OK, it will default to fill in the information of the created signature,

Final Click Finish will generate the signature key

Part II:

The app signature has been completed by the steps above! Let's start with the real package!

1.Gradle configuration:

1. First we need to copy the signature file just generated to the Project Android/app folder (your Xxx.jks file path may be different from mine, but it's OK to copy to this andrid/app path)

Then make changes to the project in the Gradle.properties file, add the following code (note the name of the following signature and alias and the previous step into the same test.jks, the following two entries respectively fill in the signature and alias password)-I took the password is ztt12345

In this step we are going to gradlde the global configuration of the variable, and we will sign the corresponding application in the following steps behind.

[note]. Please be sure to keep the above signature key, because it is needed when the application is released.

2. Add a signature to an app-configure a local app Gradle file
Directly in the project directory under the Android/app/build.gradle in the following nodes to add the following:

Note: There is no need to change the contents of the content ha! Location Lil Bit can

Finally: see if there are any react.gradle files (General Init will have, the bottom of the specific path)

Ok! As long as you have this file ~ we can start packing ~ Go to the project root directory! (is the root directory OH) Execute the following command:

CD Android &&. /gradlew assemblerelease

Then it will start packing ~ ~ (packing time will be long ~ 10 minutes) Then the following diagram will appear!

ok~ Packing Complete ~ ~

And then we'll go in, and we'll generate app-release.apk the file under the android/app/build/outputs/apk directory

All right! You can publish it! There's one more thing! If you modify the file, repackage it to run the Package command (CD Android &&. /gradlew assemblerelease ) without having to configure other stuff!!!!

Reference Document: Http://www.lcode.org/%E3%80%90react-native%E5%BC%80%E5%8F%91%E3%80%91react-native%E8%BF%9B%E8%A1%8C%E7%AD %be%e5%90%8d%e6%89%93%e5%8c%85%e6%88%90apk/

How to use Android Studio to pack react Native APK

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.