Reputation: 69
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.
Upvotes: 2
Views: 10123
Reputation: 117
Go to finder and find Android studio:
right click and click show package contents Create a new folder called jre copy the contents of the jbr folder and paste them into jre folder reload your terminal and type flutter doctor
Upvotes: 1
Reputation: 1
First you must go to finder then press right click on android studio then click show package contents . You will see jdk folder , you must copy jdk contents and create a folder as named jre. And you must paste copied content to jre folder . Finally you can run flutter doctor -v and you will see all issues disappered . enter image description here
Upvotes: 0
Reputation: 41
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).
Upvotes: 0
Reputation: 104
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.
Upvotes: 1
Reputation: 69
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.
Upvotes: 3
Reputation: 11
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
Upvotes: 1
Reputation: 11
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
Upvotes: 0