Home > Web Front-end > uni-app > uni-app offline packaging tutorial

uni-app offline packaging tutorial

P粉469731340
Release: 2022-07-19 09:23:11
Original
2443 people have browsed it


1. Resource preparation

  1. Download SDK

    Website: https://nativesupport.dcloud.net.cn/AppDocs/download/android

  2. Download Android Studio

    Website: https:// nativesupport.dcloud.net.cn/UniMPDocs/SDKDownload/android

  3. Appkey application

##                                 Starting from version 3.1.10, you need to apply for Appkey

Tutorial: https://nativesupport.dcloud.net.cn/AppDocs/usesdk/appkey

Website: https://dev.dcloud.net.cn/app/index

cmd command

Generate certificate:


keytool -genkey -alias citysmart -keyalg RSA -keysize 2048 -validity 36500 -keystore citysmart.keystore
或者
keytool -genkey -alias citysmart -keystore citysmart.keystore
Copy after login

Query the certificate, see the picture below

keytool -list -v -keystore citysmart.keystore
Copy after login

uni-app offline packaging tutorial

## 2. Pack local resources Pack the local resources of the uni-app project, release----native App-local packaging----generate local packaged App resources, which will be in the project directory Generate the "unpackage" directory as shown in the figure below

uni-app offline packaging tutorial

3. Import the SDK project

    Unzip and download the corresponding version of the SDK, which contains a native App project, as shown in the picture below
  1. uni-app offline packaging tutorial

    ##HBuilder-Integrate in the SDK -AS\simpleDemo\src\main\assets\apps__UNI__A's folder is packaged with uni-app unpackage----resources---- -UNI-*** folder and replaced
  2. Use Android Studio to open the HBuilder-Integrate-AS project
4. Modify the AS project configuration file

Modify the build.gradle file under the app
  1. signingConfigs {
        config {
            keyAlias 'citysmart'
            keyPassword '111111'
            storeFile file('citysmart.keystore')
            storePassword '111111'
            v1SigningEnabled true
            v2SigningEnabled true
        }
    }
    //keyAlias:生成证书时的别名;storeFile file:证书名全程,建议放在app项目下
    applicationId "com.zhlj.citysmart"
    //applicationId:个人中心填写的包名
    Copy after login

    2. Modify the AndroidManifest.xml file
  2. <meta-data
        android:name="dcloud_appkey"
        android:value="8285e65623ea464774523522d957e6bb" />
    //value:个人中心生成的Appkey值
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.zhlj.citysmart">
    //package:包名为个人中心填写的包名称
    Copy after login
3. Modify the control.xml file

//main\assets\data\dcloud_control.xml文件中
<hbuilder>
<apps>
    <app appid="__UNI__6FE3F0B" appver=""/>
</apps>
</hbuilder>
//appid:HBuilder中的appid
Copy after login

4. Set the App name and icon by yourself

5. AS packaging

In Click Build----Generate Signed Bundle/APK in the menu bar of Android Studio, as shown in the picture below. After opening, select APK, next
## 2. Fill in the generated .keystore certificate, password and alias, Next, see the picture below

uni-app offline packaging tutorial

## 3. Select the debug or release version, finish to complete the packaging, see the picture below

uni-app offline packaging tutorial

4. Release installation package storage path

uni-app offline packaging tutorial

The packaged APK is stored in the release folder under the APP, as shown in the figure below

uni-app offline packaging tutorial

The above is the detailed content of uni-app offline packaging tutorial. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template