HbuilderX is packaged into an apk Android installation package and installed on the phone
1. Project code packaging
Package the developed front-end code of the project into static resources such as html, css, js, etc. After packaging, the /dist folder will be automatically generated. No matter what environment the project is developed in, these static resources can be generated.
打包命令:yarnbuild
2. Download HbuilderX
This sharing requires the use of a very important tool HbuilderX, which is a very useful front-end development tool exported by dcloud.io, with a built-in function of publishing as an app.
Official download link: https://www.dcloud.io/hbuilderx.html
3. Install HbuilderX
After downloading HbuilderX, it is a compressed package, which can be installed after decompression (the green version does not need to be installed, just copy it to the desired location).
3.1 Theme selection
4. Register an account and log in
To achieve cloud packaging, you must log in on the official website (you can register one at any time without an account)
At the same time, you need to log in on the HbuilderX software. Both sides must log in and keep the same user name.
This is a necessary step. You must register and log in to
the developer background
https://dev.dcloud.net.cn/pages/common/login
5. Start packing
1 Create a project
Create a project on the Hbuilder software, select the type: 5+App
You must write the project name and project path. It is best to write the project name in English, and it is best not to have Chinese in the project path. Create it after filling it out
2 Copy the project static files to the project just created by HbuildX
Copy the previously packaged dist directory static resources to the newly created 5+App project directory for packaging into app source files.
[Theme of HBuliderX here]
After copying ----------------------->
3 Configure packaging options [key]
Click the manifest.json file in the root directory of the project to package. The main configuration items are:
Basic configuration: application ID, application name, entry page
Icon configuration: upload a square .png image as the app icon, note that the format must be .png
Module configuration: There may be a problem with the "Address Book" permission, it is recommended to close the address book permission
4 Release and package as App
Find the "Issuance" menu -> "Native App-Cloud Packaging" -> Use Public Test Certificate -> Packaging -> Continue Packaging, and then wait for about 5 minutes, the packaging can be completed and
continue -------
5 Download the apk file to the mobile phone for installation
The packaging time may take a few minutes, so wait patiently. At the same time, the first cloud packaging may prompt you to download plug-ins or register a developer account, just follow the requirements.
After the packaging is complete, you can find the .apk installation package in the project directory. If it is not in the directory, you can download it locally through the download address.
This file can be transferred to the mobile phone through WeChat, USB data cable, etc., and then it can be installed and used.