• Что бы вступить в ряды "Принятый кодер" Вам нужно:
    Написать 10 полезных сообщений или тем и Получить 10 симпатий.
    Для того кто не хочет терять время,может пожертвовать средства для поддержки сервеса, и вступить в ряды VIP на месяц, дополнительная информация в лс.

  • Пользаватели которые будут спамить, уходят в бан без предупреждения. Спам сообщения определяется администрацией и модератором.

  • Гость, Что бы Вы хотели увидеть на нашем Форуме? Изложить свои идеи и пожелания по улучшению форума Вы можете поделиться с нами здесь. ----> Перейдите сюда
  • Все пользователи не прошедшие проверку электронной почты будут заблокированы. Все вопросы с разблокировкой обращайтесь по адресу электронной почте : info@guardianelinks.com . Не пришло сообщение о проверке или о сбросе также сообщите нам.

How to run and debug projects when developing HarmonyOS applications with Uniapp

Lomanu4 Оффлайн

Lomanu4

Команда форума
Администратор
Регистрация
1 Мар 2015
Сообщения
1,481
Баллы
155
After a few days of sharing, everyone should have a certain understanding of the development syntax for using uniapp to develop HarmonyOS applications and be able to carry out some simple application development. Today, I will share how to run HarmonyOS devices when using uniapp to develop HarmonyOS applications and how to debug programs during the development process.
Run
The Uniapp project supports running on HarmonyOS real devices and emulators. However, before that, you must first create an application on the AppGallery Connect official website and copy the package name.
The second step is that if you want to run it on the real device, just connect your mobile phone directly to the computer. If you want to run to the simulator, open DevEco, open any project at random, and start the simulator.
Then, under the run menu of HbuilderX, select "Run to HarmonyOS". If it's your first time running, you may need to download the real machine run plugin here


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



Then you will see a list of devices. At this point, select the configuration certificate at the bottom, fill in the package name of the application you just created in a new pop-up window, and then click "Automatically Apply for Debug Certificate". After the information is automatically filled in, save it.


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



Select the run project again. At this point, the project will successfully run on the corresponding device
Print log
In the uniapp project, the console.log method is mainly used to print logs. The printed logs will directly appear in the console below. The logs not only contain the content but also the corresponding page path and even which line it is on.


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



You can also check the "Show Native Logs" option on the right, and you will see more accurate running information.
Breakpoint debugging
Breakpoints can also be set directly in the project code in the Uniapp project. However, it is currently only supported in the uni-app x project, and the HbulderX version needs to be above 4.61.


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



Open HbulderX, create the uni-app x project, and click the red spider button in the upper right corner of the console to open debugging


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



Now, double-click on the left side of the code where you want to interrupt to bring up the breakpoint identifier. Then the program will stop when it reaches this point.


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



On the spider bar on the left, all the breakpoint information can be seen, and breakpoints can be managed uniformly here.


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



The above is all the relevant content about running the uniapp project to HarmonyOS and debugging. Thank you for reading.


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

 
Вверх Снизу