HarmonyOS 鸿蒙Next无法创建项目

发布于 1周前 作者 bupafengyu 来自 鸿蒙OS

HarmonyOS 鸿蒙Next无法创建项目

java.lang.IllegalStateException: JCEF is not supported in this env or failed to initialize

    at com.intellij.ui.jcef.JBCefApp.getInstance(JBCefApp.java:122)

    at com.intellij.ui.jcef.JBCefBrowserBase.lambda$new$3(JBCefBrowserBase.java:160)

    at com.intellij.util.ObjectUtils.notNull(ObjectUtils.java:121)

    at com.intellij.ui.jcef.JBCefBrowserBase.<init>(JBCefBrowserBase.java:160)

    at com.intellij.ui.jcef.JBCefBrowser.<init>(JBCefBrowser.java:215)

    at com.intellij.ui.jcef.JBCefBrowser.create(JBCefBrowser.java:165)

    at com.intellij.ui.jcef.JBCefBrowserBuilder.build(JBCefBrowserBuilder.java:127)

    at com.huawei.deveco.previewer.ohos.ui.JcefManager.initBrowser(JcefManager.java:124)

    at com.huawei.deveco.previewer.ohos.ui.JcefManager.init(JcefManager.java:101)

    at com.huawei.deveco.previewer.ohos.ui.PreviewUI.lambda$loadUrl$13(PreviewUI.java:466)

    at java.base/java.util.Optional.ifPresent(Optional.java:178)

    at com.huawei.deveco.previewer.ohos.ui.PreviewUI.lambda$loadUrl$14(PreviewUI.java:465)

    at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:209)

    at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:22)

    at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:191)

    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:845)

    at com.intellij.openapi.application.impl.ApplicationImpl$4.run(ApplicationImpl.java:464)

    at com.intellij.openapi.application.impl.RwLockHolder.runWithEnabledImplicitRead(RwLockHolder.kt:75)

    at com.intellij.openapi.application.impl.RwLockHolder.runWithImplicitRead(RwLockHolder.kt:67)

    at com.intellij.openapi.application.impl.ApplicationImpl.runWithImplicitRead(ApplicationImpl.java:1438)

    at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:82)

    at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:124)

    at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:44)

    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)

    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:792)

    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)

    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:733)

    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)

    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)

    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:761)

    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:695)

    at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$12(IdeEventQueue.kt:589)

    at com.intellij.openapi.application.impl.RwLockHolder.runWithoutImplicitRead(RwLockHolder.kt:44)

    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:589)

    at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:72)

    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:355)

    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:354)

    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:793)

    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:354)

    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:349)

    at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:1014)

    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106)

    at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:1014)

    at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:349)

    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:850)

    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:391)

    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)

    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)

    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)

    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)

    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)

    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

2 回复

第一步:打开工程设置,从本地已安装的IDE中选取满足工程要求的jbr

第二步:打开工程设置,在Project中选取刚才步骤一添加好的jbr

第三步:打开IDE设置,检查maven配置,确保maven配置正确:

  • setting文件正确
  • setting文件的内容配置正确,可以正常下载依赖

第四步:打开IDE设置,检查maven下的JDK配置(确保此处的JDK是步骤一中配置好的jbr)

第五步:打开IDE设置,检查gradle下配置是否正确:

  • gradle的user home配置正确,location配置正确(可以正常下载依赖)
  • Gradle JVM 配置正确(指向的是步骤一中添加的jbr)

针对HarmonyOS 鸿蒙Next无法创建项目的问题,可以尝试以下解决步骤:

  1. 确保DevEco Studio为最新版本,并检查JDK是否已正确安装和配置。
  2. 在DevEco Studio中,尝试通过双击Shift键打开Registry界面,搜索并勾选ide.browser.jcef.gpu.disable,然后重启IDE。
  3. 检查DevEco Studio安装目录下的jvm.dll和chrome_elf.dll文件是否存在,有时这些文件可能被杀毒软件误删。
  4. 在IDE的安装路径下的bin/idea.properties文件中添加ide.browser.jcef.sandbox.enable=false,然后重启IDE。

如果问题依旧没法解决请加我微信,我的微信是itying888。

回到顶部