安裝流程
安裝完成
初始配置
-
雙擊打開
-
-
Running DevEco Studio requires the npm configuration information. You can modify the NPM Registry for an enhanced experience when downloading the npm dependencies. The configuration information is written to the C:/Users/ASUS/.npmrc file. Npm registry https://repo.huaweicloud.com/repository/npm/ 運行DevEco Studio需要npm配置信息。在下載NPM依賴項時,你可以修改NPM注冊表以獲得更好的體驗。 配置信息寫入“C:/Users/ASUS/”。npmrc文件。 Npm注冊https://repo.huaweicloud.com/repository/npm/
-
-
-
-
-
-
安裝成功檢查,點擊configure,選擇setting,輸入SDK搜索,確保Java導入成功!!
-
基本配置
-
修改主題
- file---->setting,設置如下
-
設置字體大小
-
取消注釋體並修改注釋顏色
-
自動導入包(設置完成,開發工具將幫我們自動導入包)
-
提示忽略大小寫
-
修改自動提示的快捷鍵
-
啟動程序HelloWolrd
-
登入華為‘賬號
-
-
點擊右上角人物圖標
-
-
選擇模擬器
- 啟動成功
可能出現的問題
在HarmonyOS DevEco Studio下出現SDK無法下載js的情況,該如何解決?
問題描述:
根據HarmonyOS官方文檔集成IDE成功后,下載SDK時遇到無法下載js,提示npm(node)安裝失敗等信息:
Error: : Install failed. Error: : Install js dependencies failed. Unable to run 'npm install'. Js install ation failed. See https://developer.harmonyos.com/cn/docs/documentation/doc-guid es/environment_config-0000001052902427#ZH-CN_TOPIC_0000001154865731
注:安裝js依賴項失敗,無法運行“npm install”,Js安裝失敗。
解決方法
1.安裝nodejs,官網下載:https://nodejs.org/zh-cn/download/
2.將DevEco Studio 自帶的node替換為本地安裝的node(自己從官網下載的nodejs),進入IDE軟件,打開Setting(file---->setting),設置如下圖:
3.在設置的快速搜索框內輸入node,修改DevEco Studio自帶的node,修改為自己下載的nodejs安裝位置,如下圖:
4.修改完成就可以下載SDK的js,輸入SDK,勾選js,然后點擊apply下載!
開始頁面Tips
You can inject SQL into a string literal (Alt+Enter | Inject language or reference | <SQL dialect>) and then use coding assistance for SQL.
可以將SQL注入字符串文本(Alt+Enter | inject language or reference | <SQL dialect>),然后使用SQL的編碼幫助。
DevEco Studio allows you to debug your app written in multiple languages. In a JS project or C/C++ project, you can select the Java+JS or Java+C debug type. Before debugging a hybrid project, set the debug type to Dual(Js + Java) or Detect Automatically. For a C/C++ project, set the debug type to Dual(Java + Native) or Detect Automatically.
DevEco Studio允許您調試用多種語言編寫的應用程序。在JS項目或C/C++項目中,可以選擇Java+JS或Java+C調試類型。調試混合項目之前,請將調試類型設置為Dual(Js+Java)或自動檢測。對於C/C++項目,將調試類型設置為Dual(Java+Native)或自動檢測。
Enable or disable JS postfix code completion from Settings > Editor > General > Postfix Templates. The following figure shows the supported types of postfix code completion.
從設置>編輯器>常規>后綴模板啟用或禁用JS后綴代碼完成。下圖顯示了支持的后綴代碼完成類型。
If a device in a project has multiple modules and the modules are invoked by each other, you need to install the .hap packages of multiple modules on the device in the debug phase. In this case, select Deploy Multi Hap Package in the settings of the module to be debugged.
如果項目中的一個設備具有多個模塊,並且這些模塊相互調用,則需要在調試階段在該設備上安裝多個模塊的.hap包。在這種情況下,請在要調試的模塊的設置中選擇Deploy Multi-Hap Package。
DevEco Studio supports Java code obfuscation. You can manually set proguardEnabled in the build.gradle file of the module to true to enable the function.
devecostudio支持Java代碼模糊處理。您可以在模塊的build.gradle文件中將proguardEnabled手動設置為true以啟用該功能。
When compiling code, you can use the previewer to view the UI layout. The XML, Java, JS, CSS, and HML files can be previewed. You can open the previewer in any of the following ways:
On the menu bar, go to View > Tool Windows > Previewer.
Click the Previewer tab on the right side.
Press Alt+3.
編譯代碼時,可以使用預覽器查看UI布局。可以預覽XML、Java、JS、CSS和HML文件。您可以通過以下任一方式打開預覽器:
在菜單欄上,轉至“視圖>工具窗口>預覽器”。
單擊右側的“預覽器”選項卡。
按Alt+3。
- 格式化代碼
The editor allows you to format the code in a specified range or the entire file, dramatically improving the readability of code.To format code in a specified range, press Ctrl+Alt+L (Command+Option+L on macOS).To format code in the current file, press Ctrl+Alt+Shift+L (Command+Option+L on macOS).編輯器允許您在指定范圍或整個文件中格式化代碼,從而顯著提高代碼的可讀性。要在指定范圍內格式化代碼,請按Ctrl+Alt+L(macOS上的Command+Option+L)。要格式化當前文件中的代碼,請按Ctrl+Alt+Shift+L(macOS上的Command+Option+L)。
To reinstall the app in the debugging phase while retaining the app data on the device, select the overwrite mode. Method:Go to Run > Edit Configurations, set the .hap package installation mode for the specified module, and select Replace existing application.要在調試階段重新安裝應用程序,同時在設備上保留應用程序數據,請選擇覆蓋模式。方法:轉到運行>編輯配置,為指定模塊設置.hap軟件包安裝模式,然后選擇替換現有應用程序。
Move the cursor to a field such as the class, method, parameter, or variable to view the corresponding notes. You can also click a field and press Ctrl+Q to view the notes.將光標移動到類、方法、參數或變量等字段以查看相應的注釋。也可以單擊某個字段並按Ctrl+Q鍵查看注釋。
- 直接修改樣式
The previewer supports the XML layout and JS bidirectional preview function. You can click the icon on the preview page to enable bidirectional preview.Enabling bidirectional preview allows coordination between the code editor, UI, and component tree. You can also modify styles on the preview page.預覽器支持XML布局和JS雙向預覽功能。您可以單擊預覽頁面上的圖標以啟用雙向預覽。啟用雙向預覽允許在代碼編輯器、UI和組件樹之間進行協調。也可以在預覽頁面上修改樣式。
DevEco Studio provides the following module types (moduleType): Entry, Feature, and Har, and only the Entry and Feature modules support online running and debugging.devecostudio提供以下模塊類型(moduleType):Entry、Feature和Har,只有Entry和Feature模塊支持在線運行和調試。
- 配置多項目預覽
The previewer supports cross-device preview, that is, you can preview the UI layout of a project on multiple devices at the same time.You need to manually set the supported devices in the config.json file.After you complete the setting, restart the previewer. On the preview page, click Multi-device preview to preview the UI layout on the devices.預覽器支持跨設備預覽,即可以同時在多個設備上預覽項目的UI布局。您需要在config.json文件中手動設置支持的設備。完成設置后,重新啟動預覽程序。在預覽頁面上,單擊多設備預覽以預覽設備上的UI布局。