Build Apk

October 22, 2022

Build Apk

When we are done with the code, we can package the code as a standalone apk.

On the script management page of the cloud control app, click the+button at the top to create a script project.

打包单文件

打包单文件

On the script management page of the cloud control app, click on the robot at the top to package the script project.

打包单文件

打包单文件

Enter the packaging interface. The packaging interface contains multiple configurations, and you can customize permissions, package name, application name, etc. After adjusting these configurations, click the Done (√) icon in the lower right corner to start packaging.

Here we introduce the key packaging configurations in turn.

Application configuration

  • Application name: the name displayed on the desktop after the packaged application is installed
  • Package name: the unique identifier of the application, the installation package with the same package name and signature can overwrite the installation. The package name can only contain letters, numbers, underscores, English dots, etc., and at least one English dot, such as "com.example". Packages with invalid package names cannot be installed, and the message "Installation package parsing failed" may be displayed.
  • Version name: The version name displayed to the user, such as "1.10.2".
  • Version number: An integer representing the internal version number. This integer needs to be incremented each time the version is updated.
  • Icon: The icon displayed on the desktop after the application is installed
  • Permissions: Configure the permissions in the application permission list, the default is 126 permissions. You can configure permissions as needed, and different functions require different permissions:
    • Read and write files: READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE permissions are required
    • Screenshots, foreground services: FOREGROUND_SERVICE permission is required
    • Access to the network: INTERNET permission is required
    • Task: requires WAKE_LOCK permission
    • Booting: Requires RECEIVE_BOOT_COMPLETED permission
    • Floating window: SYSTEM_ALERT_WINDOW permission is required
    • adb permission to run shell commands: requires moe.shizuku.manager.permission.API_V23 permission

If some functions are used but the corresponding permissions are not configured, an error may be reported during runtime. For example, screenshots and foreground services are used, but the FOREGROUND_SERVICE permission is not configured, and it will crash when using the corresponding functions.

Permissions can also be configured to apply automatically at startup, such as automatically applying for the WRITE_EXTERNAL_STORAGE permission, and a permission application box will pop up after the app is started after packaging. Some permissions cannot be applied for and can only be configured in the permission list.

Features

  • Image color module: To use functions such as OpenCV, image processing (cutting, binarization, etc.), image search and color search, this feature needs to be checked. If it is not checked, an error "UnsatisfiedLinkError: No implementation found for org.opencv.core..." will be reported at runtime.
  • Built-in icon pack: To use built-in icons, such as ic_add_black_48dp, etc., you need to check this feature.
  • Accessibility service: To use accessibility functions such as click, slide, and control selector, you need to check this feature. When this feature is not checked, the packaged application will not appear in the system's accessibility service management.
  • Handle external files: To use the IntentTask in the task (open, edit files, etc.), you need to check this feature. After checking, when you open some files in the file manager, you will be prompted to use the packaged application to open.
  • Node.js engine: Whether to use the Node.js engine (API v2). The Node.js engine is relatively large, with a single architecture reaching more than ten MB.
    • Automatic: automatically determined according to the packaged files and whether the API v2 is used in the project
    • Disabled: Disable the Node.js engine
    • Enable: always enable the Node.js engine
  • Built-in PaddleOCR: Select when using the built-in $ocr module.
    • disabled: do not use the built-in ocr module
    • Comes with all models: use the built-in ocr module and come with default, slim models
    • With default model: use the built-in ocr module with default model
    • With slim model: use built-in ocr module with slim model
  • Plug-ins: When using MLKit OCR, FFMpeg and other plug-ins, you need to check the plug-ins used here, so that the plug-ins can be packaged into the apk. The built-in OCR module does not need to check the plug-in here.

build configuration

  • Encryption: Select the encryption level. Refer to Encryption and Level Descriptionopen in new window.
  • CPU architecture: The default is the architecture of the current device. The CPU architecture will affect the size, compatibility, memory usage, and allowed speed of the software. The arm64-v8a architecture is faster, takes up more memory, and is only applicable to 64-bit machines. Generally speaking, the emulator does not support arm64-v8a. If you want better software compatibility, you can choose armeabi-v7a or dual architecture.
  • Obfuscate component names: whether to randomize the names of built-in components (such as broadcast, activity, service). After checking this option, the packing time will become very long, and you must keep in the foreground when packing to maintain a high scheduling priority.

Run configuration

  • Hide log: Whether to display the log interface after packaging, this option does not take effect when the script has a UI interface. Generally speaking, it is recommended that scripts do not have any interface, otherwise some functions that depend on the interface will have errors or be easily killed by the system.
  • Display startup interface: Whether to display the startup interface, the default is the interface of the software icon. Even if set to off, it will still be shown once on first boot due to initialization.
  • Startup interface text: The default is Powered by CloudControl Pro, and the text content can be customized.
  • Startup interface icon: The default is the software icon. This icon cannot fill the screen. If you need to customize it, please use the custom startup image function. (See In-App Examples -> Projects and Packaging -> Custom Splash Map)

Signature configuration

Only apps with the same package name and same signature can overwrite install and upgrade. If you need to continuously update an application, it is recommended that you use a custom signature. Because the default signature is randomly generated each time CloudControl Pro is installed, once you uninstall CloudControl Pro or clear the data, the default signature will be lost and cannot be retrieved. After the signature is lost, you need to ask users to uninstall the old version before installing the new version after you update the app and repackage it.

To create a custom signature, create a signature in the signature management, enter the password, alias and alias password to create. A signature can be used for multiple software, and each software uses a different alias and alias password, but the signature management that comes with CloudControl Pro only supports the creation of one alias.

Signature files, passwords, aliases, and alias passwords need to be kept well. Once lost or forgotten, there is no way to retrieve them.

Last update:
Contributors: Bruce