1 -> Introduction to the tool
1.1 -> Overview
Based on the open-source version of IntelliJ IDEA Community, HUAWEI DevEco Studio (hereinafter referred to as DevEco Studio) provides a one-stop distributed application development platform for all scenarios and multiple devices, supporting distributed multi-terminal development, distributed multi-device commissioning, and multi-terminal simulation, ensuring all-round quality and security.
As a development tool, in addition to basic code development, compilation, construction, and commissioning functions, DevEco Studio also has the following features:
Efficient and intelligent code editing: Supports eTS, JavaScript, C/C++ and other languages such as code highlighting, intelligent code completion, code error checking, automatic code jumping, code formatting, and code search, improving code writing efficiency.
Low-code visual development: Rich UI interface editing capabilities, support free drag-and-drop components and visual data binding, you can quickly preview the effect, what you see is what you get; At the same time, it supports zero-code development of cards, lowering the development threshold and improving the efficiency of interface development.
Multi-terminal two-way real-time preview: Supports two-way preview, real-time preview, dynamic preview, component preview, and multi-device preview of UI interface code, which is convenient for quickly viewing the code running effect.
Multi-terminal device simulation: HarmonyOS provides local simulators, remote simulators, and super terminal simulators to support the simulation of multi-terminal devices such as mobile phones, smart screens, and smart wearables, so as to easily obtain the debugging environment.
1.2 - > HarmonyOS application/service development process
With DevEco Studio, you can easily develop and launch a HarmonyOS app or service to AppGallery by following the steps below.
1.2.1 -> Development Preparation
For more information on the installation of development tools and the configuration of the environment, please refer to previous articles:
【HarmonyOS Journey】Installing DevEco Studio and Configuring the Environment
1.2.2 -> Develop applications/services
DevEco Studio integrates typical scene templates for mobile phones, smart screens, smart wearables and other devices, and can easily create a new project through the project wizard.
Next, you need to define the UI of the application/service, develop business functions, and other coding work, and view the specific development process according to the HarmonyOS Application Development Overview, and check the API interface to be called by viewing the API interface documentation.
In the process of developing code, you can use the previewer to view the effect of the application/service, and supports real-time preview, dynamic preview, two-way preview, and other functions to make the coding process more efficient.
1.2.3 -> Run, debug, and test the app/service
After the application or service is developed, you can use a real machine for debugging (you need to apply for a commissioning certificate for signature) or use an emulator for debugging, which supports single-step debugging, cross-device debugging, cross-language debugging, variable visualization and other debugging methods, making application/service debugging more efficient.
After the development of a HarmonyOS app or service is completed, the app needs to be tested for vulnerabilities, privacy, compatibility, stability, and performance before it is released to the app marketplace, to ensure that the HarmonyOS app or service is pure and secure, and to bring users a better user experience.
1.2.4 -> Publish the app/service
After the development and testing of a HarmonyOS application/service is completed, the application/service must be published to the AppGallery so that the AppGallery can distribute the application/service, and ordinary consumers can obtain the corresponding HarmonyOS Application/Service through the AppGallery or Service Center. It should be noted that HarmonyOS apps or services published to AppGallery or Service Centers must be signed with a release certificate issued by AppGallery.
2 -> Introduction to the project
2.1 -> APP package structure
Before developing an application/metaservice, developers should understand the logical structure of the application/metaservice.
An application/meta-service is published in the form of an application package (APP pack), which consists of one or more Harmony Ability Package (HAP) packages and pack.info files that describe the attributes of the app pack.
A HAP corresponds to a Module in the project directory, which is composed of code, resources, third-party libraries, and application/meta-service configuration files, and can be divided into two types: Entry and Feature.
Entry: The main module of the application, which serves as the entrance to the application and provides the basic functions of the application.
Feature: The dynamic feature module of the application, as an extension of the application capabilities, can be selectively installed according to the user's needs and device type.
For applications developed based on the Stage model and the FA model, the application package structure is different.
The structure of the Stage model application package is shown in the following figure.
The structure of the FA model application package is shown in the following figure.
2.2 -> Toggle the drawing view
The DevEco Studio project directory structure provides both project views and Ohos views. The Project view shows the actual file structure in the project, and the Ohos view hides some files that are not commonly used in the coding, and reorganizes and displays the commonly used files, so that developers can query or locate the modules or files they need to edit.
If you want to switch to Ohos view, click Project > Ohos in the upper left corner to switch to the project view.
3 -> Project directory structure
3.1 -> ArkTS Project Directory Structure (Stage Model)
The ArkTS Stage model supports API Version 10 or later, and its project directory structure is shown in the following figure:
AppScope > app.json5: the global configuration information of the app.
entry: an application/metaservice module that compiles, builds, and generates a HAP.
src > main > ets: used to store the ArkTS source code.
src > main > ets > entryability: entry point to application/meta service.
src > main > ets > pages: pages included in the app/metaservice.
src > main > resources: used to store the resource files used by the application/meta service module, such as graphics, multimedia, strings, layout files, etc.
src > main > module.json5: The stage model module configuration file contains the configuration information of HAP, the configuration information of the application on a specific device, and the global configuration information of the application.
build-profile.json5: the current module information and compilation information configuration items, including buildOption and targets configuration.
hvigorfile.ts: Module-level compilation and construction task scripts.
oh-package.json5: describes the package name, version, entry file (type declaration file), and dependencies of the third-party package.
oh_modules: Used to store the dependency information of third-party libraries, including the third-party library files that are relied upon by the application/metaservice.
build-profile.json5: application-level configuration information, including signatures and product configurations.
hvigorfile.ts: Compile and build task scripts at the application level.
oh-package.json5: describes global configurations, such as overrides, dependency overrides, and parameterFiles.
3.2 -> C++ Project Directory Structure (Stage Model)
The C++ Stage model supports API Version 10 or later, and supports the use of ArkTS+C++ for development, as shown in the following figure.
entry: the application module is compiled and built to generate a HAP.
src > main > cpp > types: API interface description files for C++
src > main > cpp > types > libentry > index.d.ts: describes the behavior of C++ APIs, such as interface names, input parameters, and return parameters.
src > main > cpp > types > libentry> oh-package.json5: configures the entry and package name of the .so third-party package declaration file.
src > main > cpp > CMakeLists.txt: CMake configuration file, which provides CMake build scripts.
src > main > cpp > napi_init.cpp: A file that defines the C++ API interface.
src > main > ets: used to store the ArkTS source code.
src > main > resources: used to store resource files used by the application, such as graphics, multimedia, strings, layout files, etc.
src > main > module.json5:The stage configuration file contains the HAP configuration, the application configuration information on specific devices, and the global configuration information of the application.
build-profile.json5: the current module information and compilation information configuration items, including buildOption and targets configuration.
hvigorfile.ts: Compile and build task scripts at the module level.
build-profile.json5: application-level configuration information, including signatures and product configurations.
hvigorfile.ts: Compile and build task scripts at the application level.
3.3 -> JS Project Directory Structure (FA Model)
JS projects only support FA models, and the structure of their project directory is shown in the following figure:
entry: an application/metaservice module that compiles, builds, and generates a HAP.
src > main > js: used to store js source code.
src > main > js > MainAbility: entry point for application/meta service.
src > main > js > MainAbility > i18n: used to configure resources in different language scenarios, such as application text entries, image paths, and other resources.
src > main > js > MainAbility > pages: Pages contained in MainAbility.
src > main > js > MainAbility > app.js: Carries the ability lifecycle.
src > main > resources: used to store resource files used by applications/metaservices, such as graphics, multimedia, strings, and layout files.
src > main > config.json: the module configuration file, which contains the HAP configuration information, the application configuration information on specific devices, and the global configuration information of the application.
build-profile.json5: the current module information and compilation information configuration items, including buildOption and targets configuration.
hvigorfile.ts: Module-level compilation and construction task scripts.
oh-package.json5: Configure the entry and package name of the third-party package declaration file.
build-profile.json5: application-level configuration information, including signatures and product configurations.
hvigorfile.ts: Compile and build task scripts at the application level.
Top comments (0)