-1

Flutter doctor showing this issue what is the solution for it?Is there any android studio installation issues or what? (https://i.stack.imgur.com/meCR3.png)

I have accepted all android licenses. Created jre file in android studio folder and copied all jbr contents to jre.Still issue is there. Result after running flutter doctor: ubuntu@ubuntu-Latitude-7480:~$ flutter doctor Doctor summary (to see all details, run flutter doctor -v): Flutter (Channel stable, 3.10.2, on Ubuntu 22.10 5.19.0-21-generic, locale en_IN) Android toolchain - develop for Android devices (Android SDK version 33.0.2) Chrome - develop for the web Linux toolchain - develop for Linux desktop Android Studio (version 2022.2) Android Studio Android Studio ✗ Unable to find bundled Java version. Android Studio VS Code Connected device (2 available) Network resources`

! Doctor found issues in 1 category.

minal
  • 1
  • try this: https://stackoverflow.com/questions/51281702/unable-to-find-bundled-java-version-on-flutter – Nguyen family Jun 02 '23 at 06:35
  • Does this answer your question? [Unable to find bundled Java version on Flutter](https://stackoverflow.com/questions/51281702/unable-to-find-bundled-java-version-on-flutter) – Nguyen family Jun 02 '23 at 08:40

1 Answers1

0

I suppose you are using android studio Flamingo. If yes, you need not have to create any jre file or anything. Flamingo already has java binary in it. You need not have to get this error in Flamingo. But since you are getting this, the thing you have to do is to set the environment variable for java in your ubundu machine.

Steps to follow:

  1. Verify you have java installed in your ubundu machine using the command java --version and javac --version. If both gives a version you are good to go. Skip step 2 and go to step 3.

  2. If no java version is available, install it using the commands:

sudo apt update

sudo apt install default-jdk

sudo apt install default-jre

  1. After installation now add the java to the environment. For that first copy the java path. Use readlink -f /usr/bin/java . It will output something similar to this: /usr/lib/jvm/java-11-openjdk-amd64/bin/java, copy the output path.

  2. Now use command sudo nano /etc/environment. This will open the /etc/environment file, you can add the JAVA_HOME variable. Add JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64", remember to remove the /bin/java part in the end. Now save(ctrl+s) and exit(ctrl+x).

  3. Now you are back on the previous terminal, use command source /etc/environment.

  4. The variable is set now. Try echo $JAVA_HOME. This will output the path we just added.

That's it. Now try flutter doctor after closing and reopening the terminal.