uni-app packaging
There are currently two uni-app packaging methods, cloud packaging and local packaging, mainly introducing local packaging.
Before starting to use packaging, let's take a look at the [Release] toolbar. Let's briefly introduce the difference between cloud packaging and local packaging:
Native APP-cloud packaging:
① 通过官方在【云服务器】已经提供好的打包环境进行打包,简单方便快捷,适合新手入门;
② 打包次数限制,1天只能打包【5次】,第六次需要收费(大概2¥一次)
③ 打包时间长度不受控,高峰期排队时长可能需要 【几个小时】以上
Native APP-local packaging:
① 需要下载 Android Studio(Android 集成开发工具)配置环境,需要熟悉原生Android 开发,操作难度大,灵活性高;
② 本地离线打包,不限制打包次数,完全免费;
③ 打包时间受控,下载好离线SDK,配置好资源环境,无需排队;
cloud packaging
- Open the project to be packaged with HBuilderX
- Select the project in the project list, right-click and select Release => Native App-Cloud Packaging, and the packaging page will pop up
- Go to the developer center to generate a certificate
- After the certificate is generated, download it, save it to the specified directory, and then select the project to be packaged in the Developer Center => My App => Certificate Management => Certificate Details to view the alias password
- Enter the alias password on the packaging page, select the downloaded certificate, you can choose not to open the screen advertisement, and then select packaging
- Finally, an apk package will be generated, downloaded and installed to use
local packaging
Download HBuilderX
download address
Download AndroidStudio
- download address
SDK download address
App offline packaging SDK download
1. Generate local packaging resources
2. Download Android Studio and App Offline SDK
Download path: https://nativesupport.dcloud.net.cn/AppDocs/usesdk/android
3. The directory obtained after decompression is as follows
4. Use Android Studio to open the folder in the Android offline SDK decompression directory, this is a sample project, we only need to change some configurations of this project, other configurations HBuilderX has been configured
5. Switch to Project
6. Open the apps directory, delete the folder under the directory, mine is __UNI__B, then open the resource directory packaged locally by HBuilderX, and finally copy it to the apps directory of the sample project, which is the location of __UNI__B just now
Change the id attribute value __UNI__B in the dcloud_control.xml file to the same id value in manifest.json
7. Add provider information to the application node of Androidmanifest.xml
Scroll down in this link and you can see that the instructions https://nativesupport.dcloud.net.cn/AppDocs/usesdk/android
code block is posted
<!--provider节点必须添加-->
<provider
android:name="io.dcloud.common.util.DCloud_FileProvider"
android:authorities="${apk.applicationId}.dc.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/dcloud_file_provider" />
</provider>
8. Here the three values are the same
The value modification here is consistent
9. Since version 3.1.10 needs to apply for Appkey configuration items
Open the developer center and select the corresponding project
Developer center address link: https://dev.dcloud.net.cn/app/index?type=0
10. Click Edit and then click Offline Packaging Key Management, you can see that SHA1 is required
11. We use Android Studio to generate
12. You can see that the sample project already has a default configuration, we can generate our own
13. Select the same directory as test.jks for the path, and write the file name. If the suffix is jks, mine is key.jks, and then save it.
14. Click OK and then X to close
15. You can see that there is already key.jks in the apps directory, you can delete test.jks
16. Then fill in the configuration information
17. Go to the key.jks directory and run the command
18. Enter the password 123456 to see the SHA1
19. Copy SHA1 to the developer center, and the Android package name should be the same as that filled in build.gradle
20. Save, get the App Key and copy it to the location corresponding to the AndroidManifest.xml file
21. Click the build icon to start packaging, complete✅
22. The directory where the apk file is located, copy it to the mobile phone and install it to use
Documentation reference
Reference article:
Original link: httts://blog.csdn.net/qq_40230735/article/details/123346723
https://blog.csdn.net/qq_41816742/details/120997499 8? UTM_MEDIUM = Distribute.pc_aggpage_search_result.none-task -blog-2aggregatepagefirst_rank_ecpm_v1~rank_v31_ecpm-3-120997498.pc_agg_new_rank&utm_term=appkey+is+not+configured+or+configured+incorrectly&spm=1000.2123.3001.4430
'keytool' is not recognized as an internal or external command, operable program or batch file. Error reference:
https://blog.csdn.net/qq_41842461/article/details/129021597
The version of the uni-app operating environment is inconsistent with the version of the compiler:
https://ask.dcloud.net.cn/article/35627