Unable to find bundled Java version error on Android Studio - flutter

[!] Android Studio (version 2022.1)
β€’ 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.
I've tried to solve this problem with "cd /Applications/Android\ Studio.app/Contents/jre", but there is no jre file in Contents folder.
I was trying to install flutter.
And to solve this problem I've downloaded openjdk version "16.0.1" and also re-installed android studio again

After installing java add this path...

Related

Unable to find bundled Java version?

In the Windows 11 environment, I used scoop to install flutter. Finally, I found the following problem. I tried all the solutions to similar problems on the Internet, but it didn’t work. It’s still the same error:
$ flutter doctor -v
[βœ“] Flutter (Channel stable, 3.3.8, on Microsoft Windows [η‰ˆζœ¬ 10.0.22000.1219], locale zh-CN)
β€’ Flutter version 3.3.8 on channel stable at D:\Program_Files\scoop\apps\flutter\current
β€’ Upstream repository https://github.com/flutter/flutter.git
β€’ Framework revision 52b3dc25f6 (2 weeks ago), 2022-11-09 12:09:26 +0800
β€’ Engine revision 857bd6b74c
β€’ Dart version 2.18.4
β€’ DevTools version 2.15.0
[βœ“] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
β€’ Android SDK at D:\Program_Files\scoop\apps\android-sdk\current
β€’ Platform android-TiramisuPrivacySandbox, build-tools 33.0.1
β€’ ANDROID_HOME = D:\Program_Files\scoop\apps\android-sdk\current
β€’ Java binary at: D:\Program_Files\scoop\apps\openjdk17\current\bin\java
β€’ Java version OpenJDK Runtime Environment (build 17.0.2+8-86)
β€’ All Android licenses accepted.
[βœ“] Chrome - develop for the web
β€’ Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[βœ“] Visual Studio - develop for Windows (Visual Studio Community 2022 17.4.1)
β€’ Visual Studio at D:\Microsoft Visual Studio\2022\Community
β€’ Visual Studio Community 2022 version 17.4.33110.190
β€’ Windows 10 SDK version 10.0.22000.0
[!] Android Studio (version 2022.2)
β€’ Android Studio at D:\Program_Files\scoop\apps\android-studio-canary\current
β€’ 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.
[βœ“] IntelliJ IDEA Ultimate Edition (version 2021.2)
β€’ IntelliJ at D:\Program Files\JetBrains\IntelliJ IDEA 2021.2
β€’ 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
[βœ“] Proxy Configuration
β€’ HTTP_PROXY is set
β€’ NO_PROXY is 127.0.0.1;localhost;::1
β€’ NO_PROXY contains localhost
β€’ NO_PROXY contains ::1
β€’ NO_PROXY contains 127.0.0.1
[βœ“] Connected device (2 available)
β€’ Windows (desktop) β€’ windows β€’ windows-x64 β€’ Microsoft Windows [η‰ˆζœ¬ 10.0.22000.1219]
β€’ Chrome (web) β€’ chrome β€’ web-javascript β€’ Google Chrome 107.0.5304.107
[βœ“] HTTP Host Availability
β€’ All required HTTP hosts are available
! Doctor found issues in 1 category.
How to solve it in my environment
If you are a mac user -
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
This solution is from #roufy235 and I'm a mac user and this worked for me. Thanks a lot #roufy235.
#roufy235's solution - https://github.com/flutter/flutter/issues/118502#issuecomment-1383215722
If you are a Windows user -
GO TO - C:\Program Files\Android\Android Studio
Then copy the content of jbr and paste the content into jre folder
run flutter doctor again and problem solved
This solution is from #1888ael. Thanks a lot #1888ael.
#1888ael's solution - https://github.com/flutter/flutter/issues/118502#issuecomment-1383219790
For anyone coming here after updating Android Studio to 2022.1 Eel, here is what works for me
Open Windows Powershell (I open from windows start icon right-click > terminal (admin)
Change directory to Android Studio, for example
cd '..\..\Program Files\Android\Android Studio\'
Create a symbolic link for "jre" with "jbr", type the following
New-Item -ItemType SymbolicLink -Path .\jre -Target .\jbr
Thanks to timbophillips for this solution
go to C:\Program Files\Android\Android Studio\jbr
copy all files
now go to C:\Program Files\Android\Android Studio\jre
and paste
thats all

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 find bundled Java version. MacBook Air M1

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).

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

Flutter NetworkImage errors

Flutter looks promising, but now and then I am stuck. In this case the error states:
package:async/src/typed/stream.dart': error: line 56: class 'TypeSafeStream' overrides method 'firstWhere' of super class or interface 'Stream' with incompatible parameters
I am using the following code that should work:
new NetworkImage(googleSignIn.currentUser.photoUrl)
fluttor doctor outputs:
[βœ“] Flutter (on Mac OS X 10.13.4 17E139j, locale nl-NL, channel dev)
β€’ Flutter version 0.1.2 at /Users/johngorter/Desktop/flutter/flutter
β€’ Framework revision 8a65872ef9 (6 days ago), 2018-02-13 23:32:28 -0800
β€’ Engine revision 05c5f817eb
β€’ Tools Dart version 2.0.0-dev.22.0
β€’ Engine Dart version 2.0.0-edge.3c4dccbd46f152be9e1b6ca95c57357e8e48057c
[βœ“] Android toolchain - develop for Android devices (Android SDK 26.0.2)
β€’ Android SDK at /Users/johngorter/Library/Android/sdk
β€’ Android NDK at /Users/johngorter/Library/Android/sdk/ndk-bundle
β€’ Platform android-27, build-tools 26.0.2
β€’ Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
β€’ Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
[!] iOS toolchain - develop for iOS devices (Xcode 9.2)
β€’ Xcode at /Applications/Xcode.app/Contents/Developer
β€’ Xcode 9.2, Build version 9C40b
βœ— libimobiledevice and ideviceinstaller are not installed. To install, run:
brew install --HEAD libimobiledevice
brew install ideviceinstaller
βœ— ios-deploy not installed. To install:
brew install ios-deploy
βœ— CocoaPods not installed.
CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
For more info, see https://flutter.io/platform-plugins
To install:
brew install cocoapods
pod setup
[βœ“] Android Studio
β€’ Android Studio at /Applications/Android Studio 3.0 Preview.app/Contents
β€’ Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
[βœ“] Android Studio (version 2.3)
β€’ Android Studio at /Applications/Android Studio.app/Contents
β€’ Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
[!] IntelliJ IDEA Community Edition (version 2017.2.3)
βœ— Flutter plugin not installed; this adds Flutter specific functionality.
βœ— Dart plugin not installed; this adds Dart specific functionality.
β€’ For information about installing plugins, see
https://flutter.io/intellij-setup/#installing-the-plugins
[βœ“] VS Code (version 1.20.1)
β€’ VS Code at /Applications/Visual Studio Code.app/Contents
β€’ Dart Code extension version 2.8.2
[βœ“] Connected devices
β€’ Android SDK built for x86 β€’ emulator-5554 β€’ android-x86 β€’ Android 7.1.1 (API 25) (emulator)
! Doctor found issues in 2 categories.
I am not using IOS (for now) and I am using VSCode.. so the issues are not causing the errors...
Is it something I have done to cause this or is it a bug in the packages?
Switching to the master channel or
adding
dependency_overrides:
async: ^2.0.4
to pubspec.yaml
and run `flutter package upgrade should do as workaround until the problem is solved.