Failing to launch my Flutter application on my android device [duplicate] - java

I installed Android Studio 4.1 and tried to run the existing project. But it gives an error like this:
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.

You have to set the JAVA_HOME Environment Variable.
On Windows, I solved the issue as follows:
Download the Java JDK from here and install it. (This links to version 15, which requires you to create an account in order to download. Version 16 is available to download without creating an account, but it has caused me an error that required me to downgrade.)
Set the "JAVA_HOME" Environment Variable:
Open Windows Search, type in “env”, and choose “Edit the system environment variables”.
Click on "Environment Variables...".
Click on "New".
Fill in the "variable name" field with "JAVA_HOME".
Fill in the "variable value" with the path to where Java is installed on your computer. (for me it was under "C:\Program Files\Java\<jdkversion>".)
Click "OK" and close all dialogs.
Restart your IDE / Terminal. (do not skip this step)

On Ubuntu 20.04 with Android 4.1, this error can be solved using the Snap version with:
flutter config --android-studio-dir=/snap/android-studio/current/android-studio

For Windows :
flutter config --android-studio-dir="C:\Program Files\Android\Android Studio"
This command works fine if you have Android Studio installed. Flutter can understand the configurations of the Android Studio and you don't have to provide JAVA_HOME anymore.
Edit (Bonus) :
Also, download "Android SDK Command-line Tools" in android studio for android-licenses. Steps are shown in the image below.

You need to install Java JDK software which is required for the android studio.
sudo apt install openjdk-11-jdk

UPDATE: run flutter upgrade to upgrade to Flutter 1.22.2, which fixes compatibility issues with Android Studio 4.1. See related Flutter release.
This issue has been resolved v
See this issue regarding Android Studio 4.1 and Flutter
You can either downgrade back to Android Studio 4.0.2 or you can
install the latest JDK and update your JAVA_HOME variable and
PATH (OS dependent).
Note that if you choose to continue using 4.1 instead of downgrading,
flutter doctor will tell you Android Studio is not installed.
You need to run flutter config --android-studio-dir='<path to android studio>' in order to fix this issue. flutter doctor will now also
incorrectly report that the Flutter and Dart plugins are not
installed even if they are - you can ignore this.

Install Android Studio (skip this step if you already installed)
Goto
C:\Program Files\Android\Android Studio\jre and copy the path.
Make New variable called "JAVA_HOME". And paste above path as the variable value.

I set my JAVA HOME to the path,
/snap/android-studio/97/android-studio/jre/
Then I set my android studio config in flutter by using this command:
flutter config --android-studio-dir=/snap/android-studio/current/android-studio
My system is :
Ubuntu 20.04 with Flutter plugin version as 4.1,

In Mac:
In your terminal run
ECHO $JAVA_HOME
This will bring up the current path of java home.Pay close attention to the path that the terminal outputs.In my case i had System/Library instead of /Library/.../... typo as my path.So i simply corrected this in bash_profile.
If your path is correct but the error persists,
Right Click On Finder
Go To Folder
Bash_Profile
Add or Edit the Java Home Path
The path you add here should be the one your terminal output when you ran Echo $Java_Home..As long as this path that was echoed was/is correct..the below steps should fix the issue.
Then open your zshrc in a similar manner as you did with bash_profile and add the home path to the file.
You can also edit the bash_profile and zshrc files in your text editor.These files can be displayed using cmd + shift + . in your home folder.
After that,save,exit the terminal, close android studio and restart your machine.
Read this Article to learn more.

Locate where your Android Studio is installed.
For me C:\Program Files\Android\Android Studio
Check if the jre folder exists, Create a new folder called jre
Copy the contents of the jbr folder and paste them into the jre folder.
Check by running flutter doctor, and Restart IDE.
Thanks: roufy235 {cause}

For ubuntu 20.04 this solution will be appropriate: -
This link solved my problem. In short I would recommend to follow the simple steps, i.e.
Upgrade the flutter using flutter upgrade
Set the path of the flutter flutter config --android-studio-dir="/path/to/android/studio/"
Set the path in bashrc file by opening bashrc file(it is a hidden file)
export JAVA_HOME="/path/to/android/studio/jre/"

choco install javaruntime
If you use choco package manager. It will set the vars automatically.

This issue can also be caused if you have updated your Android Studio.
In that case.
For Windows
First Open the Users\username\AppData\Local\Google directory on your PC/Laptop and make sure to Delete the older version of your Android Studio.
e.g, Current version of Android studio is Electric Eel (2022.1).
Delete any other older version from that directory accordingly and restart your PC or Laptop.
Then try running your project.

Install openjdk-8 ....
You have to restart your terminal, the issue will persist even after download if you don't restart the terminal.
Follow react native guide to download openjdk for your environment. ...
https://reactnative.dev/docs/environment-setup

For Windows this worked
Go to C:\Program Files\Android\Android Studio.
Copy all the files inside of jbr directory.
Paste all the files into jre directory.
Then run flutter doctor. The issue will go away.
D:\Flutterproject\rechyriedapp>flutter doctor -v
[√] Flutter (Channel stable, 3.3.8, on Microsoft Windows [Version 10.0.22621.1105], locale en-IN)
• Flutter version 3.3.8 on channel stable at C:\flutter_windows_3.3.8\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 52b3dc25f6 (3 months 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.0)
• Android SDK at C:\Users\USER\AppData\Local\Android\Sdk
• Platform android-TiramisuPrivacySandbox, build-tools 33.0.0
X No Java Development Kit (JDK) found; You must have the environment variable JAVA_HOME set and the java binary in your PATH. You can download the JDK from https://www.oracle.com/technetwork/java/javase/downloads/.
[√] 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.4)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.4.33213.308
• Windows 10 SDK version 10.0.22000.0
[!] Android Studio (version 2022.1)
• Android Studio at C:\Program Files\Android\Android Studio
• 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
X Unable to find bundled Java version.
• Try updating or re-installing Android Studio.
[√] Connected device (4 available)
• CPH2095 (mobile) • 86db9605 • android-arm64 • Android 12 (API 31)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22621.1105]
• Chrome (web) • chrome • web-javascript • Google Chrome 109.0.5414.120
• Edge (web) • edge • web-javascript • Microsoft Edge 109.0.1518.55
[√] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 2 categories.
After that copy all file from jbr to jre
D:\Flutterproject\rechyriedapp>flutter doctor -v
[√] Flutter (Channel stable, 3.3.8, on Microsoft Windows [Version 10.0.22621.1105], locale en-IN)
• Flutter version 3.3.8 on channel stable at C:\flutter_windows_3.3.8\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 52b3dc25f6 (3 months ago), 2022-11-09 12:09:26 +0800
• Engine revision 857bd6b74c
• Dart version 2.18.4
• DevTools version 2.15.0
Checking Android licenses is taking an unexpectedly long time...[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at C:\Users\USER\AppData\Local\Android\Sdk
• Platform android-TiramisuPrivacySandbox, build-tools 33.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
• 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.4)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.4.33213.308
• Windows 10 SDK version 10.0.22000.0
[√] Android Studio (version 2022.1)
• Android Studio at C:\Program Files\Android\Android Studio
• 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 11.0.15+0-b2043.56-8887301)
[√] Connected device (4 available)
• CPH2095 (mobile) • 86db9605 • android-arm64 • Android 12 (API 31)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22621.1105]
• Chrome (web) • chrome • web-javascript • Google Chrome 109.0.5414.120
• Edge (web) • edge • web-javascript • Microsoft Edge 109.0.1518.55
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!

Download Liberica JDK and on installation it will automatically set JAVA_HOME environment variable.
Now you just go to Android Studio -> Project Structure -> SDK -> Point all jdk path to liberica jdk installation directory and apply.
You are done. Just restart android studio and gradle command will work.

Related

Missing bundled JRE in Android Studio for Flutter

Setting up Flutter on MacOS Ventura 13.2 on an M1 MacBook Air. I've installed everything to get [✓] except for flutter doctor unable to find a bundled jre in Android Studio. I have found some other questions on this site, but none helped.
alan#Alans-MacBook-Air ~ % flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.0, on macOS 13.2 22D49 darwin-arm64 (Rosetta), locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[!] Android Studio (version 2022.1)
✗ Unable to find bundled Java version.
[✓] VS Code (version 1.74.3)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
Here's the full output of the Android Studio section:
[!] 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 have java installed:
alan#Alans-MacBook-Air ~ % java -version
java version "19.0.2" 2023-01-17
Java(TM) SE Runtime Environment (build 19.0.2+7-44)
Java HotSpot(TM) 64-Bit Server VM (build 19.0.2+7-44, mixed mode, sharing)
alan#Alans-MacBook-Air ~ % /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/jdk-19.jdk/Contents/Home
I also have my environment setup correctly, I think:
alan#Alans-MacBook-Air ~ % echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk-19.jdk/Contents/Home
Some other questions suggest playing with symlinks in the jre folder in the Android Studio install, but I have no jre folder in there. There is however a jbr folder, which appears to contain an OpenJDK build. But I don't know how to get flutter to see/use it.
alan#Alans-MacBook-Air ~ % /Applications/Android\ Studio.app/Contents/jbr/Contents/Home/bin/java -version
openjdk version "11.0.15" 2022-04-19
OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
OpenJDK 64-Bit Server VM (build 11.0.15+0-b2043.56-8887301, mixed mode)
Installed all the components as required in the documentation. I think I've set environment and other parts up correctly.
UPDATE 2
While the suggestion in Update 1 would work, this is not a "script" interpreted in real-time, and rather part of the flutter binary (if I am not mistaken), so in order for this to work, one would have to compile the flutter binary again, I don't know how to do that right now (as I've never used flutter beyond the basics) and I can't certainly do it on my "work machine" where the Corporate eyes forbid everything that is fun.
In other words, use the symlink trick you found in this GitHub issue until the Flutter team releases an updated flutter that searches for the correct java Path in the newer versions of Android Studio.
And Jetbrains, please, stop renaming the java location every other year...
UPDATE 1
In the flutter sdk, there's a file called: android_studio.dart. (well there are various android related files, none "java" related, since it seems like Flutter treats Java as an "android thing" (judging by the fact that all java references and validations or checks are performed in android_ files).
This file is located in path/to/flutter/packages/flutter_tools/lib/src/android/android_studio.dart.
Inside it contains this to calculate the path to java:
final String javaPath = globals.platform.isMacOS ?
version != null && version.major < 2020 ?
globals.fs.path.join(directory, 'jre', 'jdk', 'Contents', 'Home') :
globals.fs.path.join(directory, 'jre', 'Contents', 'Home') :
globals.fs.path.join(directory, 'jre');
In essence, if you add another entry like this:
globals.fs.path.join(directory, 'jbr', 'Contents', 'Home') :
So it ends up looking like:
final String javaPath = globals.platform.isMacOS ?
version != null && version.major < 2020 ?
globals.fs.path.join(directory, 'jre', 'jdk', 'Contents', 'Home') :
globals.fs.path.join(directory, 'jre', 'Contents', 'Home') :
globals.fs.path.join(directory, 'jbr', 'Contents', 'Home') :
globals.fs.path.join(directory, 'jre');
Then you can run flutter doctor and it may work.
I also removed the && version.major < 2020 part, just to ensure it was always run. Now I see:
[!] Android Studio (version 2022.1)
✗ Unable to find bundled Java version.
[✓] Android Studio (version 2021.3)
So... Two different Android Studio versions, the latest (the one with jbr instead of jre seems to work fine.
In Android Studio Electric Eel, the bundled Java was moved to /Applications/Android Studio.app/Contents/jbr/Contents/Home so you can set your $JAVA_HOME to point to that directly.
In Addition, if you're on macOS (as it looks like that's the case) remember macOS uses (for some Apple reason) a binary called java_home to set the JAVA installations.
You can find this binary in /usr/libexec/java_home.
It seems like the flutter plug-in may be looking for Java under the assumption that it's under the "old" jre instead of the "new" jbr folder. I don't know if this is hardcoded (and therefore needs a 'patch') or if it just reads the environment variable for JAVA_HOME.
Are you using Jetbrain Toolbox to manage Android Studio?
If so, my solution may work for you.
I'm also using M1Air, Flutter 3.7.0, Android Studio Electric Eel 2022.1.1
cd ~/Library/Application\ Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/{ YOUR_VERSION_OF_ANDROID_STUDIO }/Android\ Studio.app/Contents/
run ls and look for /jbr
run sudo ln -s jbr jre and flutter doctor
This solved my problem.
EDIT
Your version of Android Studio can be found at Jetbrain Toolbox -> Android Studio -> Settings(3 dots on the right) -> Configuration -> Install Location
Related Github Issue

Unable to find bundled java version. flutter doctor

I'm facing this issue on windows after upgrading Android Studio to Electric Eel.
flutter doctor returns:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.3.10, on Microsoft Windows [Version 10.0.22621.1105], locale en-US)
Checking Android licenses is taking an unexpectedly long time...[√] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[√] Chrome - develop for the web
[!] Visual Studio - develop for Windows (Visual Studio Community 2022 17.4.3)
X The current Visual Studio installation is incomplete. Please reinstall Visual Studio.
[!] Android Studio (version 2022.1)
X Unable to find bundled Java version.
[√] VS Code (version 1.74.3)
[√] Connected device (4 available)
[√] HTTP Host Availability
! Doctor found issues in 2 categories.
I've tried adding a JAVA_HOME kind of solution but didn't work for me.
I had that problem today after updating Android Studio, and found an answer here:
https://github.com/flutter/flutter/issues/118502
The solution is basically:
Go to your AndroidStudio folder (normally C:\Program Files\Android\Android Studio in Windows)
Copy the content of jbr and paste the content into jre folder
Quick workaround from here: https://github.com/flutter/flutter/issues/118502#issuecomment-1384954269
Run in the terminal:
cd /Applications/Android\ Studio.app/Contents
ln -s jbr jre
*solution for MacOS

Flutter unable to locate Java Runtime after updating Android Studio?

I updated android studio to Electric El, but after updating, it is unable to find Java Runtime.
Flutter doctor gives this error and the code does not compile.
maazaftab#maazs-MacBook-Pro edge-focus-mobile % flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.
[✓] Flutter (Channel beta, 3.7.0-1.2.pre, on macOS 13.0.1 22A400 darwin-arm64, locale en-PK)
[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
✗ Could not determine java version
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
[✓] Chrome - develop for the web
[!] Android Studio (version 2022.1)
✗ Unable to find bundled Java version.
[✓] IntelliJ IDEA Community Edition (version 2022.3)
[✓] VS Code (version 1.62.3)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
! Doctor found issues in 2 categories.
In your zshrc file add.
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jbr/Contents/Home
Restart the android studio. Flutter doctor will give this.
maazaftab#maazs-MacBook-Pro edge-focus-mobile % flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, 3.7.0-1.2.pre, on macOS 13.0.1 22A400 darwin-arm64, locale en-PK)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
[✓] Chrome - develop for the web
[!] Android Studio (version 2022.1)
✗ Unable to find bundled Java version.
[✓] IntelliJ IDEA Community Edition (version 2022.3)
[✓] VS Code (version 1.62.3)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
You can ignore the warning ✗ Unable to find bundled Java version. but the code will compile successfully.
Open the folder where Android Studio is installed.
In most cases, it is "C:\Program Files\Android\Android Studio"
Open the "jbr" folder inside the Android Studio folder ("C:\Program Files\Android\Android Studio\jbr"), and copy all contents in it.
Then go back and create a new folder called "jre" -> "C:\Program Files\Android\Android Studio\jre"
Paste all contents which you copied from "jbr" folder to "jre" folder.
Click Start and search for "Environment" and open "Edit the Environment variables" from search result.
Click to open "Environment variables"
On "User variables" pane click new and add new variable with name "JAVA_HOME" and path "C:\Program Files\Android\Android Studio\jre". Click OK to save.
Restart Android Studio and run flutter doctor. It will solve the problem.
Android Studio folder screenshot
Environment screenshot

Execution failed for task ':app:packageDebug' when trying to build starter flutter app to android

I'm trying to build my first flutter project, and just finished the installation. When attempting to build the default starter app to an android emulator, the following error shows up:
> A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
> com.android.ide.common.signing.KeytoolException: Failed to read key AndroidDebugKey from store "C:\Users\phcar\.android\debug.keystore": Integrity check failed: java.security.NoSuchAlgorithmException: Algorithm HmacPBESHA256 not available
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
Exception: Gradle task assembleDebug failed with exit code 1
This is the output of flutter doctor -v
[√] Flutter (Channel stable, 3.3.7, on Microsoft Windows [Version 10.0.19044.2130], locale en-US)
• Flutter version 3.3.7 on channel stable at D:\Coding_stuff\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision e99c9c7cd9 (28 hours ago), 2022-11-01 16:59:00 -0700
• Engine revision 857bd6b74c
• Dart version 2.18.4
• DevTools version 2.15.0
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc1)
• Android SDK at C:\Users\phcar\AppData\Local\Android\sdk
• Platform android-32, build-tools 33.0.0-rc1
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.3.6)
• Visual Studio at D:\Coding_stuff\src\VisualStudio
• Visual Studio Community 2022 version 17.3.32929.385
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2020.3)
• Android Studio at C:\Program Files\Android\Android Studio
• 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 11.0.10+0-b96-7249189)
[√] IntelliJ IDEA Community Edition (version 2021.2)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.2.3
• 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.73.0)
• VS Code at C:\Users\phcar\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.52.0
[√] Connected device (3 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.2130]
• Edge (web) • edge • web-javascript • Microsoft Edge 106.0.1370.34
[√] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
I do not plan on developing for the web, so didn't bother to download chrome as I don't use it as my browser.
Any ideas on why this is happening?

Android license status unknown and a weird problem

Steps to Reproduce
I am running flutter in windows 10. I previously had a running android setup. After cloning the flutter repo and updating path, I ran flutter doctor -v. The logs are below. Now after searching a bit for solving the problem, I came across to this solution from various stackoverflow answers: Flutter.io Android License Status Unknown
I at first executed this:
set JAVA_OPTS=-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee
Though I don't know how to make it permanent. Then after running flutter doctor again, I came with another message, see log ###2
So it says Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[!] Android Studio (version 3.4). So I ran flutter doctor --android-licenses accordingly. And it gives another error, that is:
A newer version of the Android SDK is required. To update, run:
C:\Users\imazi\AppData\Local\Android\sdk\tools\bin\sdkmanager --update
Well, so I ran C:\Users\imazi\AppData\Local\Android\sdk\tools\bin\sdkmanager --update to update it. And it kinda updated successfully outputting [=======================================] 100% Computing updates...
So I thought the issue is solved and ran flutter doctor again but it seems that nothing has been changed the problem still remains. It is like a loop. I do everything and the problem remains as it is. The output of the last flutter doctor is in log ### 3
My java version is:
10.0.2 2018-07-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)
Please help.
!! also opened a github issue here: https://github.com/flutter/flutter/issues/39637
Logs
1 flutter doctor -v
O:\Flutter installation>flutter doctor -v
[√] Flutter (Channel stable, v1.7.8+hotfix.4, on Active code page: 1252
Microsoft Windows [Version 10.0.18362.295], locale en-US)
• Flutter version 1.7.8+hotfix.4 at O:\Work_Anon\Flutter installation\flutter
• Framework revision 20e59316b8 (6 weeks ago), 2019-07-18 20:04:33 -0700
• Engine revision fee001c93f
• Dart version 2.4.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
**• Android SDK at C:\Users\imazi\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.1
• Java binary at: O:\Work_Anon\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
**X Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit
https://flutter.dev/setup/#android-setup for detailed instructions.****
[!] Android Studio (version 3.4)
• Android Studio at O:\Work_Anon\Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[!] Connected device
! No devices available
2 flutter doctor after set JAVA_OPTS=-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee
[√] Flutter (Channel stable, v1.7.8+hotfix.4, on Active code page: 1252
Microsoft Windows [Version 10.0.18362.295], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[!] Android Studio (version 3.4)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[!] Connected device
! No devices available
3 last flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.7.8+hotfix.4, on Active code page: 1252
Microsoft Windows [Version 10.0.18362.295], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.1))
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[!] Android Studio (version 3.4)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[!] Connected device
! No devices available
Actually, the problem got solved after installing jdk 8 and setting JAVA_HOME accordingly this new jdk. Also in the sdkmanager.bat file, located in C:\Users\username\AppData\Local\Android\Sdk\tools\bin
I added the line set JAVA_HOME="C:\Program Files\Java\jdk1.8.0_221"
No need to uninstall java 10. That solved the whole problem!
Check if the flutter path is added.
Restart your system
Then run flutter doctor --android-licenses
accept all the licenses that appear
again run flutter doctor
and check if the issue persists
I uninstall the java jdk from my system and then let my flutter doctor arise that error of " [!] Android toolchain - develop for Android devices (Android SDK version 29.0.1)"
and then followed the solution that flutter doctor was giving as it says to run the command " flutter doctor --android-licenses " and then type " y " as it says you to accept the licenses provided to solve this problem of "[!] Android toolchain - develop for Android devices (Android SDK version 29.0.1)" and then I again ran flutter doctor and the problem was resolved.

Categories

Resources