Simple optimization of deep learning fun apps (applicable to newcomers)

According to the previous article, a cat classifier can be implemented quickly with zero code.

Then, Here comes problem. How can we optimize this app?


This article is an advanced version of How to Make a Fun App for deep learning with Zero Code.

1. Preparations (UnversalClassifiers need to be downloaded in advance.)

a) Sync project

b) Open UniversalClassifier

2. Beautify the app.

a) Add a model file.

b) Change the home screen background.

c) Change the background of the button.

d) Change the text on the main interface.

3. Process of generating digital signatures and packing APKs that can be released

a) Generate JKS and related configurations.

b) Start packing the APK.

4. Putting an Huawei AppGallery on the shelf

a) Log in to the Huawei Developer website.

b) Click AppGallery connect.

c) Click My Applications.

d) Click My Applications.

e) Click New.

f) Fill in the application introduction as required.

g) (Important!!) Select Hong Kong in China as the release region. If you select Chinese mainland, electronic copyright approval will be required and you cannot participate in the Shining Star Pilot activity.

h) Upload the APK of the released version.

i) The privacy statement is mandatory.

j) Submit an application for putting the product online.

5. Related activities

a) Campus incentive activities (for students)

b) Singing Star Project (socially oriented)

c) AI Innovative Application Integration Gift Activity (Social Oriented)

d) Huawei HMS Core game recruitment (not applicable

Preparations (UniversalClassifiers need to be downloaded in advance.)

sync project

Open UniversalClassifier

The following page is displayed. If the page is displayed, skip this step.

Beautify the app.

a) Add a model file.

1. Replacing a Model File

2. Open the customized project (mindsporeDemo) trained by using the HMS ToolKit plug-in zero code, and find the model file .ms and tag file in app/src/main/assets.

3. Copy the two files in the same path as app/src/main/assets in this project.


MinsporeDemo is the demo generated in the previous article. This project and universalClassifier in this document are two projects.

Copy the model file trained by MindsporeDemo to the new app.

In app\src\main\java\com.huawei.mlkit.sample\activitys\CustomActivity, if the model file is generated by Mindspore, you only need to change the name in the red box in the following figure.

b) Change the home screen background.

Place the image to be replaced in app\src\main\res\drawable. If the following page is displayed, click split.

c) Change the background of the button.

Method 1:

For details, see the app\src\main\res\layout\activity_main file.

To invoke the button whose background needs to be changed, use the android:background=”@drawable/file name” button to save the image to the address of the directory where the button is located.


Change the name of the circle_stroke_background image in android:background=”@drawable/circle_stroke_background” to replace the button background.

Method 2


The content is as follows:

You can also add your own Android controls to the app. Modify the configuration according to the preceding figure. For details about how to use the control, see the CSDN.

All buttons and texts can be dragged.

d) Change the text on the main interface.

Find android:text=”MLKIT” in the label in app\src\main\res\layout\activity_main. MLKIT is the set font. Replace it.

Android: textColor: Sets the font color (# + hexadecimal color code).

Android:textSize Sets the font size (positive integer).

Android: testStyle setting fonts


Normal: Default




Process of generating digital signatures and packing APKs that can be released

a) Generate JKS and related configuration

b) Start packing the APK.

Note: If the build varitants button on the left does not exist,

Click this button (ignoring the pop-up dialog box).

Location of the last generated APK that can be released

Putting an Huawei AppGallery on the shelf

a) Log in to the Huawei Developer website.

  1. Click Management Center. If no management center is available, log in to the system first. If no developer is registered

2. After the registration is complete, real-name authentication is required. After logging in to the account, click to access the management center in the upper right corner.

3. You can select individual authentication or company authentication based on your account type.


l Individual developer authentication: You need to use your ID card number and bank card number for authentication. (Note: If you have already authenticated another account using your real name, you cannot use your own account for authentication again.) For details, see the website page.

l Enterprise developer authentication: For enterprises in China, you need to prepare the unified social credit code, account opening bank, and public account. For enterprises in foreign regions, you need to prepare information such as the legal entity name, company address, business license, and bank account number. For details, see the website requirements. Note that enterprise certification may take about two business days.

Global release: You can determine whether to release your application globally based on your application situation.

Whether to integrate cloud services: MLKit provides cloud and device services. For details, see:

Create an app in AppGallery Connect and select a data storage area based on your region.

Create multiple (a maximum of four) apps with different package names in AppGallery Connect and select the data storage region based on the region where the app is installed. To provide the same service experience in different regions around the world, you are advised to install different apps in four regions (China Mainland, EU/EEA, Russia, and other regions). Different applications differ in data storage locations.

For details about how to create an application, see:;

For details about how to set the storage area, see the following:

4. Add the appgallery configuration to the code. You can refer to the following link to integrate the obtained agconnect-services.json file into the code.

5. Update app information

1) Log in to AppGallery Connect and choose My Apps.

2) Find your app in the list and click the version you want to upgrade.

3) Click Upgrade in the upper right corner. The New Version Draft menu is displayed in the navigation tree.

4) Click Application Information in the navigation tree on the left to refresh application details. For details, see Configuring Application Information. Click Save. The Draft page is displayed

5) Click Software Package under Software Version. In the displayed dialog box, select the software package of the released version and click Select.

6) Click Submit in the upper right corner. The system displays a message indicating that the software package of the current version is the same as the software package of the released version. Click Confirm.

After the application is submitted, the application status changes to To be approved and the version number remains unchanged. After the application is approved, the application details are updated. The latest application details are displayed on Huawei AppGallery.

6. Self-check

1) Log in to AppGallery Connect and choose My Project.

2) Find your project in the project list and touch the self-check app on the project card. The Project Setting page is displayed.

3) Choose Quality > Integration Check and click New Check.

4) Confirm that the application information is correct and click Submit.

a) If Category, Payment Type, and Country/Region are not automatically displayed, enter them.

b) Click Browse to upload the app package to be checked.

5) After the check task is complete, view the check result on the Check History page.

Click Report to check

6) Click More to view details about the application. Click Delete to delete the self-check record.

7. Release an application.

After an app is developed, it needs to be submitted for review in AppGallery Connect.

1) Log in to AppGallery Connect and choose My Applications.

2) Touch the app you want to release. The app information page is displayed.

3) Configure the app information.

The following table lists the related parameters.

4) In the displayed Select language dialog box, select a language to be supported.

If a green check box is displayed on the right of a language, the basic localization of the language is complete.

5) If the basic localization of a language is not complete, a red prompt is displayed.

6) Click Save. In the dialog box that is displayed, click OK to continue configuring the version information.

7) Set the country/region where the application is to be published. Click Add under Country/Region, select a country/region, and publish the application.

8) Set whether to be an open test version. If the open test function is enabled for your app, you can set the version for open test. Set this parameter to No for the officially released version. If you set this parameter to Yes, configure the app by referring to.

9) Uploading the Software Package

Click Manage package.

10) If no package is uploaded during application creation, click Upload. In the displayed dialog box, click to upload the software package.

11) If an application package has been uploaded during application creation, select the application package and click Select.

12) Configure payment information. 1. Select a payment type based on the application. For example, if your app is free, select Free.

13) If your app is paid, select Pay.

14) Configure content rating. In the Content Rating area, click App Rating and select a rating based on your application.

15) Configure Privacy Description. If an app package requires privacy permissions, specify the permission usage in the text box.

16) Configure copyright information: Upload disclaimers and other qualification files. The file must be in the .jpg, .png, or .bmp format. The size of a single file cannot exceed 4 MB. Applications and games have different requirements for uploading application copyright certificates or proxy certificates. — Apps: Disclaimer must be provided when apps are released to Chinese Mainland.

17) Schedule an app release. Set the release date of the app. After the application is approved, you can publish the application immediately or at a specified time (accurate to seconds).

Contact information:

If you have any questions, feel free to contact us.

Android developer