flutter-intellij icon indicating copy to clipboard operation
flutter-intellij copied to clipboard

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

Open msmith3392 opened this issue 3 years ago • 21 comments

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)

msmith3392 avatar Oct 26 '23 04:10 msmith3392

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.

bytesfellow avatar Oct 28 '23 10:10 bytesfellow

This was fixed with the point releases, please update to the latest version, 76.3.x.

jwren avatar Nov 08 '23 21:11 jwren

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.

huycozy avatar Dec 26 '23 04:12 huycozy

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)

The same error in my Android Studio Hedgehog | 2023.1.1

Antilamer1709 avatar Dec 28 '23 16:12 Antilamer1709

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?

wolkenschieber avatar Dec 29 '23 16:12 wolkenschieber

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

sadjadtalakoob74 avatar Dec 31 '23 12:12 sadjadtalakoob74

@jwren The same to me Plugin Version: Flutter: 77.1.2 Dart: 231.9409

IDEA Version : Android Studio Hedgehog | 2023.1.1 Patch 1 Runtime version: 17.0.7+0-17.0.7b1000.6-10550314 aarch64

image

weniner avatar Jan 04 '24 03:01 weniner

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.

helin24 avatar Jan 04 '24 20:01 helin24

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

same for me. the error is still present

Mikelantonio avatar Jan 10 '24 07:01 Mikelantonio

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)

waslost0 avatar Jan 11 '24 07:01 waslost0

Same issue on windows

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. Windows 10 19045.3930 Non-Bundled Plugins: Dart (231.9411) io.flutter (77.1.2)

ProZhar avatar Jan 16 '24 08:01 ProZhar

same issue here on macos

dominikIncibit avatar Jan 22 '24 10:01 dominikIncibit

Same issue on MacOS

"The embedded browser failed to load. Error JCEF is not supported in this env or failed to initialize"

Flutter plugin: 77.1.2 Android Studio Hedgehog | 2023.1.1 Patch 2 Build #AI-231.9392.1.2311.11330709, built on January 19, 2024 Runtime version: 17.0.7+0-17.0.7b1000.6-10550314 aarch64

nickolight avatar Jan 24 '24 16:01 nickolight

same for me. the error is still present

iak-a-dev avatar Feb 02 '24 13:02 iak-a-dev

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

danielL22 avatar Feb 05 '24 16:02 danielL22

Why this issue is closed?

waslost0 avatar Feb 06 '24 08:02 waslost0

Same issue here, tried the solutions over github and stackoverflow,

  1. file -> invalidate caches and restart
  2. changing JRE, mine already supported JCEF

Inspector still doesn't work

flutter inspector

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-b2043.56-10550314 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Windows 10.0 GC: G1 Young Generation, G1 Old Generation Memory: 4096M Cores: 8 Registry: external.system.auto.import.disabled=true debugger.new.tool.window.layout=true ide.text.editor.with.preview.show.floating.toolbar=false ide.instant.shutdown=false ide.experimental.ui=true

Non-Bundled Plugins: Dart (231.9411) io.flutter (77.1.2)

mrcodefrost avatar Feb 18 '24 20:02 mrcodefrost

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

jperezrealini avatar Feb 19 '24 16:02 jperezrealini

Thank you @jperezr21 , your solution worked for me !

mrcodefrost avatar Feb 19 '24 17:02 mrcodefrost

For my case it was related with Markdown view. So what worked for me:

  1. Choose Boot Java Runtime for the IDE (double shift to search)
  2. Select the latest bundled runtime that comes with JCEF support, ok and restart
  3. Again search for Registry and enable jcef.browser and disable markdown view
  4. restart

sadighasanzade avatar Mar 01 '24 08:03 sadighasanzade