HarmonyOS

HarmonyOS phone and other development including DevEco Studio 2.1 beta 3 released

Huawei DevEco Studio is an all-in integrated development environment for Huawei’s full scenario and multiple devices, providing developers with project template creation, development compilation, debugging, end to end HarmonyOS application development services such as testing and publishing them on the store.

Previously, Huawei already released two DevEco Studio beta versions that brought lots of new changes, improvements, and features, which help out the developers in improving the innovation productivity.

Now, Huawei has started delivering one more beta for developers, DevEco Studio 2.1 Beta 3. With the latest changelog, the company introduced new features including a two-preview function, data simulation function, and much more.

New Beta version:

  • Huawei DevEco Studio 2.1 Beta 3

What’s in this update:

  • The previewer adds a two-way preview function
  • The previewer adds the data simulation function of the Java UI interface
  • The editor adds config.json visual configuration function
  • The editor has a new resource creation wizard function
  • New Java testing framework
  • Added 5 new phone project templates
  • Optimizations for existing features

Take a look at new changes in detail:

1. The previewer adds a two-way preview function

At the time of HarmonyOS application development, the developers need to click “Previewer” to view the application’s UI interface effect. When the developer finds that the layout display of the UI interface does not meet expectations (eg: the width of the control does not meet the set value, the control is not displayed, etc.), so it is necessary to check the layout or control abnormality in the UI interface one by one.

In order to improve the efficiency of development, DevEco Studio 2.1 Beta 3 unlocks the two-way preview function on the basis of the existing “real-time preview” and “dynamic preview”.

  • Real-time preview: As long as the modified source code is saved in the layout file, the layout effect can be viewed in real-time in the previewer.
  • Dynamic preview: In the previewer interface, you can operate the interactive actions of the application in the previewer, such as click events, jumps, and slides, which are consistent with the interactive experience of the application running on a real device.

The so-called two-way preview is to support the linkage between the code editor and the previewer interface (including the property list), which is convenient for quickly positioning the control, thereby improving the efficiency of solving UI interface problems. Developers can open the two-way preview function by clicking on the icon on the previewer interface.

The specific linkage effects are as follows:

  1. After modifying the attribute or style through the attribute list in the previewer interface, the source code in the code editor will be modified synchronously, and the previewer interface will be refreshed in real-time.
  2. Similarly, if you modify the source code in the code editor, the previewer interface and attribute list will be refreshed in real-time.

2.The previewer adds the data simulation function of the Java UI interface

In the preview scene, because the code running environment is different from the running environment on the real device, a valid return value cannot be obtained when calling some interfaces. If developers want to make different UI interface displays based on the return value, they need to manually modify the code logic repeatedly to verify the effects of different UI interfaces.

In order to reduce the modification, DevEco Studio provides PreviewMock data simulation function, that is, without changing the business operation logic, simulate the return value of various methods in the API or business code (excluding the construction method) and the Field in the object (not including final field). In this way, the developer can view the interface changes brought about by different return values ​​during the preview.

However, it is worth mentioning that DevEco Studio 2.1 Beta 3 currently only supports the PreviewMock data simulation function of the Java UI interface. At the same time, if you want to use the PreviewMock data simulation function, you need to add related dependencies in the module’s build.gradle, and resynchronize the project.

In addition to the above features, in the preview of the Java UI interface, when the developer previews Ability or AbilitySlice, save the modified code to achieve real-time preview; in the preview of the JS UI interface, the developer can directly select a certain A page (page) for real-time dynamic preview.

3. The editor adds config.json visual configuration function

As an introductory player in HarmonyOS application development, do you repeatedly consult the documentation on the HarmonyOS official website in order to understand the meaning of the configuration items? In order to reduce the behavior of developers repeatedly switching the interface to look up data and documents, DevEco Studio 2.1 Beta 3 has added a new visual configuration function.

Developers can open the config.json file and click the button to open the settings interface to view the important attributes and their meanings that need to be filled in the project and improve the configuration of application name, application version number, application type, ability, device type, application permissions, etc. item.

However, during the development process, there may be scenarios with too many levels of configuration items, for example: when configuring the “Module ›Ablilities› Meta Data ›Merge Rule› Replace” field, the user can quickly locate the attribute through the search box and click the add button, Enter the relevant merge rules, trigger the system to automatically create a tree structure of configuration items in the config.json file, complete the configuration of the merge rules, and save configuration time.

4. The editor has a new resource creation wizard function

When creating a resource catalog with qualifiers, developers need to consider the value of the qualifiers, the order in which different qualifiers match each other, etc. A slight deviation will cause HarmonyOS to fail to detect suitable resources when the application is running. Unable to show the expected effect.

In order to reduce the chance of errors when developers create resource directories with qualifiers, DevEco Studio 2.1 Beta 3 adds a new resource creation wizard function. Users can select or input according to the interface prompts to complete the creation of resource directories and files without thinking. The combination of various qualifiers.

5. New Java testing framework

In order to reduce the tedious manual testing process, DevEco Studio 2.1 Beta3 adds a new Java testing framework, providing white-box testing capabilities for Java code, helping developers to efficiently write and execute test cases, and to ensure the basic quality of applications.

In the development stage, developers can use the IAbilityDelegator provided by the Java testing framework to perform APP component manipulation tests (such as starting/closing FA, obtaining interface UI elements, injecting UI click events, etc.) to discover UI interaction problems in time. Or use the JUnit 4 syntax paradigm to write test cases, call system interfaces, obtain API return values ​​or trigger business processes, and judge the correctness of business logic based on interface return values ​​or business status.

Prerequisites for the Java testing framework to run on a real machine or remote simulator device:

  1. The remote simulator needs to register a developer account and complete real-name authentication
  2. The real device must be equipped with HarmonyOS operating system, debug mode should be turned on, and the corresponding signature file should be provided.

6. Added 5 new phone project templates 

DevEco Studio supports seven devices: Phone, Tablet, Car, Smart Screen (TV), Smart Wearable, Lightweight Smart Wearable (Lite Wearable), and Smart Vision. HarmonyOS application development supports Java, JS, and C/C++ programming languages.

In order to facilitate the use of developers, DevEco Studio provides ability templates for multiple device types and different development languages. In this new version, on the original basis, 5 new mobile phone (Phone) project templates are added, and there are currently 19 mobile phones (Phone) project templates. Developers can select appropriate templates according to the project wizard, easily create projects suitable for all types of equipment, and automatically generate corresponding code and resource templates.

7. Additional optimizations

  1. Upgrade IntelliJ IDEA base to IntelliJ IDEA CommunityEdition 2020.2.4 version (warm reminder: due to base upgrade, developers need to manually upgrade unavailable third-party plug-ins to avoid incompatibility with installed third-party plug-ins)
  2. In the debugging phase, the developer can set the installation method of the hap package. If you choose to overwrite the installation, the cached data in the installed application will be retained, and there is no need to reinstall the application and then rebuild the relevant data, which is convenient for debugging.
  3. Solved the problem of slow or failed downloading of Node.js by some developers. By integrating Node.js and pre-installing the npm warehouse of Huawei’s public cloud, the time to build a HarmonyOS application development environment is further shortened.
  4. It has been adapted to support macOS 11.2.2 version.
  5. Solved the problem that the drawable resources in XML cannot be associated.

(Via – ithome)

Telegram

Facebook

Twitter



Comments

Popular

To Top