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

What happened

Trying to load Flutter Inspector in Android Studio on Ubuntu 23.04

Version information

Android Studio Giraffe | 2022.3.1 Patch 2 • Flutter plugin io.flutter 76.1.2 • Dart plugin 223.8977

Flutter 3.13.8 • channel stable • https://github.com/flutter/flutter.git Framework • revision 6c4930c4ac (7 days ago) • 2023-10-18 10:57:55 -0500 Engine • revision 767d8c75e8 Tools • Dart 3.1.4 • DevTools 2.25.0

Exception

null

java.lang.IllegalStateException: JCEF is not supported in this env or failed to initialize
	at com.intellij.ui.jcef.JBCefApp.getInstance(JBCefApp.java:250)
	at com.intellij.ui.jcef.JBCefBrowserBase.lambda$new$3(JBCefBrowserBase.java:152)
	at com.intellij.util.ObjectUtils.notNull(ObjectUtils.java:124)
	at com.intellij.ui.jcef.JBCefBrowserBase.<init>(JBCefBrowserBase.java:152)
	at com.intellij.ui.jcef.JBCefBrowser.<init>(JBCefBrowser.java:190)
	at com.intellij.ui.jcef.JBCefBrowser.<init>(JBCefBrowser.java:150)
	at io.flutter.view.EmbeddedJcefBrowserTab.<init>(EmbeddedJcefBrowser.java:23)
	at io.flutter.view.EmbeddedJcefBrowser.openEmbeddedTab(EmbeddedJcefBrowser.java:61)
	at io.flutter.view.EmbeddedBrowser.openBrowserTabFor(EmbeddedBrowser.java:115)
	at io.flutter.view.EmbeddedBrowser.openPanel(EmbeddedBrowser.java:62)
	at io.flutter.view.FlutterView.lambda$addBrowserInspectorViewContent$3(FlutterView.java:294)
	at java.base/java.util.Optional.ifPresent(Optional.java:178)
	at io.flutter.view.FlutterView.lambda$addBrowserInspectorViewContent$4(FlutterView.java:294)
	at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:209)
	at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:21)
	at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:191)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:838)
	at com.intellij.openapi.application.impl.ApplicationImpl$3.run(ApplicationImpl.java:454)
	at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:74)
	at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:114)
	at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:36)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:788)
	at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
	at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:731)
	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:758)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:909)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:756)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$5(IdeEventQueue.java:437)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:436)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
	at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:615)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:434)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:838)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:480)
	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)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (3 by maintainers)

Most upvoted comments

I’m seeing this issue on Flutter plugin 77.1.2 and Android Studio Hedgehog | 2023.1.1:

Screenshot 2023-12-26 at 11 02 34
flutter doctor -v (beta channel)
[!] Flutter (Channel beta, 3.18.0-0.2.pre, on macOS 14.1 23B74 darwin-x64, locale en-VN)
    • Flutter version 3.18.0-0.2.pre on channel beta at /Users/huynq/Documents/GitHub/flutter_beta
    ! Warning: `flutter` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_beta.
      Consider adding /Users/huynq/Documents/GitHub/flutter_beta/bin to the front of your path.
    ! Warning: `dart` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_beta. Consider
      adding /Users/huynq/Documents/GitHub/flutter_beta/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision fed06b31d9 (12 days ago), 2023-12-13 14:53:33 -0800
    • Engine revision 39c6dc9bdd
    • Dart version 3.3.0 (build 3.3.0-174.3.beta)
    • DevTools version 2.30.0
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/huynq/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/huynq/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A507
    • CocoaPods version 1.13.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.1)
    • Android Studio at /Applications/Android Studio Hedgehog.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • android-studio-dir = /Applications/Android Studio.app/
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.85.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.78.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 14.1 23B74 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 120.0.6099.109

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

Here’s what worked for me:

First, update the runtime to one with JCEF following these steps:

  1. Select Help > Find Action from the Android Studio menu.
  2. Enter “Choose Boot Java Runtime for the IDE” and select it from the suggestion list.
  3. Select the latest bundled runtime that comes with JCEF support
  4. Click OK and restart the IDE

Then, if you’re getting this error: GPU process restarts too many times and seems to be unstable. Try to restart IDE or disable GPU acceleration completely. follow these steps:

  1. Select Help > Find Action from the Android Studio menu.
  2. Look for Registry…
  3. Find the ide.browser.jcef.sandbox.enable option in the list and disable it
  4. Restart

Why this issue is closed?

JCEF not being supported is due to boot runtime for the IDE using a version of the Java runtime environment that does not have JCEF. We recommend trying the steps here for changing to a JRE that supports JCEF: https://stackoverflow.com/questions/69171807/markdown-editor-and-preview-not-working-in-android-studio

Does that work for your use case? Otherwise the backup option is opening DevTools in a separate browser.

I’m seeing this issue on Flutter plugin 77.1.2 and Android Studio Hedgehog | 2023.1.1

Same on Linux.

`flutter doctor -v` [✓] Flutter (Channel stable, 3.16.5, on Arch Linux 6.6.8-arch1-1, locale de_DE.UTF-8) • Flutter version 3.16.5 on channel stable at /mnt/Development/flutter/sdk/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 78666c8dc5 (vor 10 Tagen), 2023-12-19 16:14:14 -0800 • Engine revision 3f3e560236 • Dart version 3.2.3 • DevTools version 2.28.4

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc4) • Android SDK at /mnt/Development/android/sdk • Platform android-34, build-tools 34.0.0-rc4 • Java binary at: /mnt/Development/jetbrains/android-studio/jbr/bin/java • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314) • All Android licenses accepted.

[✓] Chrome - develop for the web • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop • clang version 16.0.6 • cmake version 3.28.1 • ninja version 1.11.1 • pkg-config version 2.1.0

[✓] Android Studio (version 2023.1) • Android Studio at /mnt/Development/jetbrains/android-studio • Flutter plugin version 77.1.2 • Dart plugin version 222.4582 • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

[✓] IntelliJ IDEA Community Edition (version 2023.3) • IntelliJ at /mnt/Development/jetbrains/intellij-idea-community-edition • Flutter plugin version 77.0.1 • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] IntelliJ IDEA Ultimate Edition (version 2023.3) • IntelliJ at /mnt/Development/jetbrains/intellij-idea-ultimate • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] Connected device (3 available) • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 14 (API 34) (emulator) • Linux (desktop) • linux • linux-x64 • Arch Linux 6.6.8-arch1-1 • Chrome (web) • chrome • web-javascript • Google Chrome 120.0.6099.129

[✓] Network resources • All expected network resources are available.

• No issues found!

@jwren Can you reopen the issue?

JCEF not being supported is due to boot runtime for the IDE using a version of the Java runtime environment that does not have JCEF. We recommend trying the steps here for changing to a JRE that supports JCEF: https://stackoverflow.com/questions/69171807/markdown-editor-and-preview-not-working-in-android-studio

Does that work for your use case? Otherwise the backup option is opening DevTools in a separate browser.

Did that and my emulators stopped working. Had to reset to default again

Same issue

Android Studio Hedgehog | 2023.1.1 Patch 1 Build #AI-231.9392.1.2311.11255304, built on December 27, 2023 Runtime version: 17.0.7+0-17.0.7b1000.6-10550314 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 13.5 Non-Bundled Plugins: Dart (231.9411) io.flutter (77.1.2)

same error on Flutter plugin 77.1.2 and Android Studio Hedgehog | 2023.1.1

same for me. the error is still present

The same issue happens on macOS 14.0 (23A344).

Android Studio Giraffe | 2022.3.1 Patch 2
Build #AI-223.8836.35.2231.10811636, built on September 14, 2023
Runtime version: 17.0.6+0-17.0.6b829.9-10027231 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 14.0
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 10
Metal Rendering is ON
Registry:
    external.system.auto.import.disabled=true
    ide.text.editor.with.preview.show.floating.toolbar=false

Non-Bundled Plugins:
    com.github.copilot (1.3.3.3572)
    Dart (223.8977)
    DBN (3.4.1710.0)
    io.flutter (76.1.2)

looks like an IntelliJ issue in general https://github.com/flutter/flutter-intellij/issues/6857

It’s a pain since JxBrowser requires licensing.