기술나눔

harmonos 프로젝트를 openharmony 프로젝트로 수정하는 방법

2024-07-12

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

처음에는 하모니오스와 오픈하모니의 차이를 구분하지 못해서 하모니오스에서 직접 개발 소프트웨어를 다운받았는데, 나중에 뭔가 문제가 있는 걸 발견해서 다시 생각해봤습니다.

먼저, 해당 버전의 개발 소프트웨어를 설치해야 합니다. Hongmeng은 두 공식 웹사이트(harmonyos 및 openharmony)에서 개발되었습니다. 해당 위치를 찾아 해당 버전의 개발 소프트웨어를 다운로드하면 됩니다. 원본 프로젝트를 실행할 수 없습니다.

다음 두 작업은 다음과 같습니다. 먼저 프로젝트 파일 build-profile.json5에 다음 코드를 붙여넣습니다.

  1. {
  2. "app": {
  3. "signingConfigs": [],
  4. "products": [
  5. {
  6. "name": "default",
  7. "signingConfig": "default",
  8. "compileSdkVersion": 10,
  9. "compatibleSdkVersion": 10,
  10. "runtimeOS": "OpenHarmony",
  11. }
  12. ],
  13. "buildModeSet": [
  14. {
  15. "name": "debug",
  16. },
  17. {
  18. "name": "release"
  19. }
  20. ]
  21. },
  22. "modules": [
  23. {
  24. "name": "entry",
  25. "srcPath": "./entry",
  26. "targets": [
  27. {
  28. "name": "default",
  29. "applyToProducts": [
  30. "default"
  31. ]
  32. }
  33. ]
  34. }
  35. ]
  36. }

2. 항목 파일 아래의 build-profile.json5를 수정하여

  1. {
  2. "apiType": 'stageMode',
  3. "buildOption": {
  4. },
  5. "targets": [
  6. {
  7. "name": "default",
  8. "runtimeOS": "OpenHarmony"
  9. },
  10. {
  11. "name": "ohosTest",
  12. }
  13. ]
  14. }

3. 장치에 다시 서명

4. 프로젝트를 닫고 프로젝트 파일을 지운 후 다시 엽니다.

마지막으로 감사합니다 아이유