Establishing the project

  1. Download HBuilderX and log into your dclould account (required)
  2. New project

Local package

The packaged file

Go back to the previous two levels

You will need to copy the entire \_\_UNI\_\_354F6F0 directory later

Generate the offline packaging Key

The specific methods: https://ask.dcloud.net.cn/art…

Generate a certificate

Enter the following commands after installing the JDK

Command format:

Keytool -genkey-alias certificate alias -keyalg rsa-keysize 2048 -validity of the certificate -file name of the keystore certificate

Note:

  1. This is the password for the certificate and must be recorded. Let’s say the password is “leonardpwd”.
  2. And then after you type in a bunch of information he’ll ask you if you’re correct, and at that point you have to manually type “yes”
keytool -genkey -alias leonard-app -keyalg RSA -keysize 2048 -validity 36500 -keystore leonard-app.keystore

Check the certificate

-list-v-keystore -app.keystore -app.keystore -app.keystore -app.keystore -app.keystore -app.keystore -app.keystore

The information displayed is similar to the text below, where the SHA1 of the certificate fingerprint will be needed later

Enter keystore password: keystore type: PKCS12 keystore provider: SUN Your keystore contains 1 entry alias: leonard-app Date created: May 31, 2021 Entry type: privateKeyEntry Certificate Chain Length: 1 Certificate [1]: CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown CN= UNKNOWN, OU= UNKNOWN, O= UNKNOWN, L= UNKNOWN, ST= UNKNOWN, C= UNKNOWN SERial number: A2AC5FD0886B0130 Mon May 31 10:51:26CST 2021, Expiry Time: Wed May 07 10:51:26CST 2121 Certificate Fingerprint: SHA1: 99:23:00:18:40:20:D1:F3:41:D5:70:6D:38:94:56:58:68:C3:1E:33 SHA256: A9:8 f: 17:63:3 a: shower: 15:1 C: 6 f: B8:30: D7: A4:59:42:99: F8:04:6 0:8 6:8 enter C: 83: B3:1 e: C4:2 e: F3: AA: EB: name of 07 signature algorithm: SHA256Withrsa Principal Public Key Algorithm: 2048-bit RSA Key Version: 3 Extension: #1: ObjectId: 2.5.29.14 Criticality= False SubjectKeyIdentifier [KeyIdentifier [0000: 88 41 F4 2F A9 C5 F4 68 86 D7 6E E9 D5 3D A9 F1 .A./...h..n..=.. 0010: A2 DF 3B 89 ..;. ] ]

Set the Key

Open the dCloud Developer Center and click on our project

Click “Offline Package Key Management” and fill in the relevant information

So that’s our appKey

Android related configuration

File location:https://nativesupport.dcloud….

  1. Install the Android Studio
  2. Download the APP offline SDK
  3. After downloading, unzip to get
  4. Copy the HBuilder-HelLouniApp folder into a place to store it

Import the project

Open Android Studio and Open an Existing Project.

Note that it may take a long time to open it for the first time, and Android Studio is importing the relevant files


Project configuration

Delete the project original file

Click to show the details

Delete the sample folder that comes with the project

Copy the project

Once you have finished packaging in the section “Local packaging”, copy the entire folder below

Paste it into the Apps folder

The final result

Set the APPID

Open Manifest. json and copy the ID

Open data/dcloud_control.xml and paste it with the ID you just copied

Set the AppKey

Open the dCloud Developer Center in the webpage, enter the project, click “Offline Package Key Management”, and copy the Android App Key

Paste to manifests/AndroidManifest. The meta – data in the XML node (the node at the bottom of the file again the most commonly)

Set up the certificate

  1. Open the build.gradle file (note it’s not the one above, you can tell it by the parentheses after the file name).
  2. Then fill in the relevant information inside SigningConfigs-> Config

    KeyAlias' certificate alias' keyPassword 'certificate password' storeFile file(' certificate path, note double slash ') storePassword 'certificate password'
  3. Click on the top right and Sync Now

Modify the applicationId

  1. build.gradle -> manifestPlaceholders -> apk.applicationId

    I was com. Leonard. App

  1. AndroidManifest.xml

    The values in the package are the same as those in the build.gradle file

To modify the provider

Open AndroidManifest. XML, look for Android: Authorities, and change the value to xx.xx.xx. fileProvider

I changed to com here. Leonard. App. Fileprovider

Packaging APK

Build -> Build Bundle(s) / APK(s) -> Build APK(s)

When you’re done packing, you’ll be prompted in the lower right corner. Click Locate to find the APK file

Open the Android phone, install the APK to view

END