Unable to find bundled Java version. MacBook Air M1 - flutter

I was using flutter on MacBook Pro with intel. It was working fine. Now I switch to MacBook Air with M1 chip. I get error Unable to find bundled Java version. How can I fix it pleas?
flutter doctor -v
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.2 20D64 darwin-arm, locale
en-KW)
• Flutter version 2.2.3 at /Users/mac/FlutterDev/flutter
• Framework revision f4abaa0735 (5 weeks ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/mac/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Library/Internet
Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
• Java version Java(TM) SE Runtime Environment (build 1.8.0_301-b09)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.10.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[!] Android Studio (version 2020.3)
• 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
✗ Unable to find bundled Java version.
• Try updating or re-installing Android Studio.
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 11.2 20D64 darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.131
! Doctor found issues in 1 category.

I fix it by changing Contents folder location.
from
/Applications/Android Studio Preview.app/Contents/jre/Contents
to
/Applications/Android Studio Preview.app/Contents/jre/jdk/Contents
after close the android studio preview I face a problem with start it again.
but in general flutter doctor works with no Issues.

I had the same problem and solved it this way
cd /Applications/Android\ Studio.app/Contents/jre
ln -s /Library/Java/JavaVirtualMachines/jdk-16.0.1.jdk jdk
flutter doctor -v
enter image description here

I had the same problem a few days ago when I installed Android Studio for ARM64, I noticed that JDK from Oracle right now was running in x64. Looking in the web I found that you can install a native JDK for M1.
So basically the way that I found to solve your problem of the best way was installing JDK 15 arm64 from Azul
It improves a lot the compiler time for Android app's.

about ✗ Unable to find bundled Java version. • Try updating or re-installing Android Studio.
I have another environments. But you can think by use my answer.
In my opinion, you need to install JDK(Java development Kit).
If you can use Visual studio extensions or android studio plugin(i don't know mac environment), find Java extension pack for installation JDK(this is on visual studio)and install. You have to select JAVA Path correctly. If you select it on install process, you don't need to choose Path process individually. You can see this path on System variable Path as JAVA_HOME named automatically. not user path.
I hope your flutter is well

First of all, check what's going on with your JAVA_HOME:
echo $JAVA_HOME
I assume in your case you would already have it set correctly, so it should appear in a path like this (the jdk version may vary):
/Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home
If it the path looks the same (or same with different java version), and you have also checked "where java", "java -version" etc, to make sure that the terminal recognises your java well and there is no other obvious java issue, that means that the only thing you need to do is to run these commands:
cd /Applications/Android\ Studio.app/Contents/jre
ln -s ../jre jdk
ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk
Now if you run flutter doctor -v, you should see no java errors and something like this instead of the previous error:
• Java binary at: /Applications/AndroidStudio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
And no more errors :)
Hope this helps! It definitely solved the issue for me after switching to an M1 MacBook Air and upgrading the AndroidStudio to ArcticFox 2020.3.1 Patch 1).

Related

How to fix Chrome showing an empty / transprarent window for a Flutter web app on Linux?

When I run a Flutter web app in Chrome using Android Studio I only get an empty / transparent window on my Linux Mint 20.2 system.
empty / transparent chrome window of flutter web app
I have already tried reinstalling Chrome, which did not help. I have tried different Flutter projects including a fresh demo project (with web support), but the transparent screen shows up regardless. The same result shows up when I run flutter run -d chrome.
Anyone know how to fix this?
These are the results of flutter doctor -v:
flutter doctor -v
[✓] Flutter (Channel stable, 2.10.3, on Linux Mint 20.2 5.14.0-1032-oem, locale en_US.UTF-8)
• Flutter version 2.10.3 at /home/janik/snap/flutter/common/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7e9793dee1 (5 weeks ago), 2022-03-02 11:23:12 -0600
• Engine revision bd539267b4
• Dart version 2.16.1
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /home/janik/Android/Sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /opt/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Android Studio (version 2021.1)
• Android Studio at /opt/android-studio
• Flutter plugin version 66.0.1
• Dart plugin version 211.7811
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.2)
• IntelliJ at /opt/idea-IU-203.7148.57
• 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
[✓] VS Code (version 1.66.1)
• VS Code at /usr/share/code
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (1 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 100.0.4896.75
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
this seems like an issue with the latest chrome update so I expect this to be fixed soon, meanwhile as a workaround what it worked for me and I suggest you do is to use chromium instead, which works.
Install chromium and find its executable which chromium, for me is use/bin/chromium and the version of chromium installed is: Version 83.0.4103.116 (Developer Build) built on Debian bullseye/sid, running on Debian bullseye/sid (64-bit), I am running Pop O.S 20.04, Dart 2.16.1 • DevTools 2.9.2, Flutter 2.10.2 • channel stable.
In the terminal where you will run the flutter app export a variable pointing to chromium: export CHROME_EXECUTABLE=/usr/bin/chromium, now you can run:
flutter run -d chrome and it will actually use chromium which renders the window properly.
I would expect this to be fixed soon, I will open an issue on the flutter repo if it's not there yet.
Good luck.
I don't have answer, only similar problem. Mint 20.2 Ryzen 3 2200G with Radeon Vega Graphics. Transparent window in Chrome using Android Studio AND ALSO in Visual Studio Code, even when creating a new (demo) project without any own code. But Pixel mobile emulator works, no problem in 'virtual' phone!! So, is this chrome-related problem? This problem emerged a few weeks ago.
I had similar issue but clearing Chrome’s cache worked like a charm

Flutter / Dart syntax highlighting is not working

The syntax of the dartcode in my flutter project is no longer being highlighted and cannot click the declarations or do autocomplete of code, like typing: StreamBuilder( and then click enter to create the widget for a streambuilder.
See example code below, where normaly, the different elements would be coloured:
This problem occured after I installed intelliJ, I did this because I needed to write some javascript for firebase functions.
Tried this so far, with no luck:
deleting android studio and re-install it.
invalidate caches and restart.
restart analyses server
checked that dart and flutter has the right paths under 'languages & frameworks'
created a new flutter project, here everything works just fine. but if i copy in my codebase the issue persists
Im using android studios latest version.
EDIT:
Apparently I have some issues after all with the plugins. But as seen in the picture, I've given the paths to both flutter and dart.
Its somehow related to intelliJ because when i click the links from the flutter doctor output it takes me to jetbrains website
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.3 20E232 darwin-x64, locale da-DK)
• Flutter version 2.2.3 at /Users/jeffmayn/Desktop/Development/flutter
• Framework revision f4abaa0735 (10 weeks ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/jeffmayn/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: /Library/Java/JavaVirtualMachines/jdk-15.0.1.jdk/Contents/Home/bin/java
• Java version Java(TM) SE Runtime Environment (build 15.0.1+9-18)
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[!] Android Studio (version 2020.3)
• 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
✗ Unable to find bundled Java version.
• Try updating or re-installing Android Studio.
[✓] Connected device (2 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 93.0.4577.63
! Doctor found issues in 2 categories.
Process finished with exit code 0
I think reinstalling Flutter and Dart plugin to Android Studio can help. Syntax highlighting is plugins' job.
The solution of yoppuyoppu worked for me, but as he mentioned, only for the selected files.
So here is a small addition that makes it work for all .dart files:
In the "Register New File Type Association" window you can change the File pattern to "*.dart".
And of course select Dart as shown.
That way all files ending with ".dart" will be associated with Dart.
In my case, only one file had such problem. And it turned out I screwed up the file type association of the file when I created it.
Fix was to reassociate the file with Dart.
Go to the menu bar >> File >> File Properties >> Associate with File Type...
And in the dialog that follows, pick Dart and click OK.
You can choose as many files as you like at any one time.
None of the suggested solutions worked out for me. What I did was then:
create a new flutter project.
setup dart and flutter plugins.
copy in all my code, files, assets, etc. from the old project to the new.

Unable to find any JVMs matching version "1.8"

Im new to flutter. Im running on macos catalina(10.15.7 (19H15)). I installed Flutter(2.2.3)
I download java 16 and installed it. And also i set the path.
java version "16.0.2" 2021-07-20
Java(TM) SE Runtime Environment (build 16.0.2+7-67)
Java HotSpot(TM) 64-Bit Server VM (build 16.0.2+7-67, mixed mode, sharing)
thilinaabhisheka#Thilinas-MacBook-Air ~ % /usr/libexec/java_home -V
Matching Java Virtual Machines (1):
16.0.2, x86_64: "Java SE 16.0.2" /Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home
Im using Android studio 2020.3.1. when im run flutter doctor I got this error
Unable to find any JVMs matching version "1.8".
Unable to find any JVMs matching version "1.8".
[✓] Flutter (Channel stable, 2.2.3, on Mac OS X 10.15.7 19H15 darwin-x64, locale en-GB)
• Flutter version 2.2.3 at /Users/thilinaabhisheka/Developer/Flutter
• Framework revision f4abaa0735 (8 weeks ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
⣟Unable to find any JVMs matching version "1.8". [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/thilinaabhisheka/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /usr/bin/java
• Java version Java(TM) SE Runtime Environment (build 16.0.2+7-67)
• All Android licenses accepted.
[✗] Xcode - develop for iOS and macOS
✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[!] Android Studio (version 2020.3)
• 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
✗ Unable to find bundled Java version.
• Try updating or re-installing Android Studio.
[✓] Connected device (2 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.159
! Doctor found issues in 2 categories.
Install homebrew
now try it brew install --cask homebrew/cask-versions/adoptopenjdk8
if you have used an android studio then set from the project structure.

Unable to locate a development device; please run 'flutter doctor' .. but doctor checks out ok

A new installation of flutter/dart went smoothly without issue .. running "flutter doctor -v" gives the following output:
$ flutter doctor -v
[✓] Flutter (Channel beta, v0.11.9, on Linux, locale en_AU.UTF-8)
• Flutter version 0.11.9 at /home/jedaa/bin/flutter
• Framework revision d48e6e433c (3 days ago), 2018-11-20 22:05:23 -0500
• Engine revision 5c8147450d
• Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.2)
• Android SDK at /home/jedaa/bin/Android/sdk
• Android NDK location not configured (optional; useful for native
profiling support)
• Platform android-28, build-tools 28.0.2
• ANDROID_HOME = /home/jedaa/bin/Android/sdk
• Java binary at: /opt/android314/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-
b06)
• All Android licenses accepted.
[✓] Android Studio (version 3.2)
• Android Studio at /opt/android314
• Flutter plugin version 30.0.1
• Dart plugin version 181.5656
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-
b06)
[✓] IntelliJ IDEA Community Edition (version 2018.2)
• IntelliJ at /opt/idea
• Flutter plugin version 30.0.2
• Dart plugin version 182.5124
[✓] VS Code (version 1.29.1)
• VS Code at /usr/share/code
• Flutter extension version 2.20.0
[!] Connected device
! No devices available
! Doctor found issues in 1 category.
and yet attempting to run the defalut starter app "flutter/material.dart" results in ... "Unable to locate a development device; please run 'flutter doctor' for information about installing additional components" ... irrespective whether i use Intellij or Visual Studio.
However,
$ flutter devices
1 connected device:
Pixel XL • HT69R0205363 • android-arm64 • Android 9 (API 28)
I have searched the web and found similar complaints .. but no solution. I was hoping that someone might be able to throw some light on this as I am sure it must be something simple and straight forward.
Visual Studio is a new installation but I have been using Intellij now for 6 months on a daily basis and rarely have issue with it .. especially one that i cannot fix. :)
Thank you in advance.
open Terminal in Android Studio or VS Code.
and writes this command :
flutter config --android-sdk <sdk-location>
SDK-location is your Path for SDK! for Example :
flutter config --android-sdk /home/sanaebadi/Pasport/programming/and_dev/sdk/sdk-tools-linux-3859397/
I had the same problem , then I tried this solution , and it helped me and my flutter app is running on my phone ..
all you need to do is install Android API level 29 (Android 9.0+ "Q")
go to Setting > Android SDK >SDK platform>Check Android 9+ and Press Apply button
I found this solution from github .. her is the link ..
Hope this help you
https://github.com/flutter/flutter/issues/22649#issuecomment-520472515
In Android Studio, ensure that the API level of your Project SDK (File->Project Structure) <= of the API level of your AVD.

Android SDK is missing command line tools

I've installed flutter but when I run flutter doctor to verify the installation, I get:-
Android SDK is missing command line tools
I've doubled checked that the command lines are installed.
What do I need to do remove this error?
I've included the full flutter doctor -v output below:-
$ flutter doctor -v
[✓] Flutter (Channel beta, v0.3.1, on Mac OS X 10.13.4 17E202, locale en-AU)
• Flutter version 0.3.1 at /Users/chris/flutter
• Framework revision 12bbaba9ae (2 weeks ago), 2018-04-19 23:36:15 -0700
• Engine revision 09d05a3891
• Dart version 2.0.0-dev.48.0.flutter-fe606f890b
[!] Android toolchain - develop for Android devices
• Android SDK at /usr/local/Caskroom/android-platform-tools/27.0.1
• Android NDK location not configured (optional; useful for native profiling support)
• ANDROID_HOME = /usr/local/Caskroom/android-sdk/3859397
✗ Android SDK is missing command line tools;
• Try re-installing or updating your Android SDK,
visit https://flutter.io/setup/#android-setup for detailed instructions.
[✓] iOS toolchain - develop for iOS devices (Xcode 9.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.3, Build version 9E145
• ios-deploy 1.9.2
• CocoaPods version 1.5.0
[✓] Android Studio (version 3.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 24.1.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
[✓] IntelliJ IDEA Ultimate Edition (version 2018.1.2)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 24.1.2
• Dart plugin version 181.4668.60
[!] Connected devices
! No devices available
! Doctor found issues in 2 categories.
On Android Studio open SDK Manager.
Go to SDK Tools tab.
Check if Android SDK Command-line Tools is checked. If not, check and apply the changes.
For some reason, after updating flutter and Android Studio, I got this error too. Seems like some new requirement that for some reason wasn't automatically installed.
This fixed it for me.
I think ANDROID_HOME and ANDROID SDK should be pointing to the same path and that is the SDK's root directory.
In my .bashrc (on LINUX), following are
export ANDROID_HOME=/home/myname/Android/Sdk
export PATH=/home/myname/Android/Sdk:$PATH
export PATH=/home/myname/Android/Sdk/platform-tools:$PATH
export PATH=/home/myname/Android/Sdk/tools:$PATH
export PATH=/home/myname/Android/ndk-build:$PATH
Just solved the problem. Here are my system settings:
System variable ANDROID_SDK_ROOT points to my Android SDK dir
In system Path variable, I have sdk/tools, sdk/platform-tools, and /flutter-dir/bin
Also make sure you don't have dulplicated directories. I previously downloaded another platform-tools and add it to Path, so I had to delete it and use the sdk's one.
After changing those things, I close the flutter cmd windows and run flutter doctor on PowerShell. Worked like a charm!
Please download the latest sdk build-tools to solve the problem of Android SDK is missing command line tools