Unable to find bundled Java version? - flutter

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

Related

cant run the flutter apps on android studio

i'm going to learn flutter.
so i installed the latest version of flutter(Flutter 3.3.8) and make the path of that on windows.
then i installed the latest version of android studio(Android Studio Dolphin | 2021.3.1 Patch 1) and installed the flutter plugin and sdk and emulator of api 32 and 29 on it.
also i installed the java jdk and jre v8.
but when i try to run the defult app on emulator in recevied this error on terminal :
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:7.1.2.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.1.2/gradle-7.1.2.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.1.2/gradle-7.1.2.pom
Required by:
project :
and here it is the result of doctor command of flutter :
C:\Users\new>flutter doctor -v
[√] Flutter (Channel stable, 3.3.8, on Microsoft Windows [Version 10.0.18363.535], locale en-US)
• Flutter version 3.3.8 on channel stable at E:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 52b3dc25f6 (9 days 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\new\AppData\Local\Android\sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: E:\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[X] Visual Studio - develop for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2021.3)
• Android Studio at E:\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.13+0-b1751.21-8125866)
[√] VS Code, 64-bit edition (version 1.71.2)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension can be installed from:
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (3 available)
• sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 12 (API 32) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.18363.535]
• Chrome (web) • chrome • web-javascript • Google Chrome 107.0.5304.107
[√] HTTP Host Availability
• All required HTTP hosts are available
I would be grateful if you could guide me in solving this problem.
thx to all!
build.gradle codes
Add google() to your repositories(buildscript and allprojects sections) of app level build.gradle file. The Android Gradle plugin is located there: your_project_folder/android/build.gradle
buildscript {
...
repositories {
google()
mavenCentral()
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
after some days and try many ways to solve this problem!
found the right solution :
proxy setting was my problem and config that with new proxy settings solve that problem!
thanks everyone.
solved!

How to fix app crash issue with Flutter in_app_purchse 3.0.7 and Billing 5.0.0?

I'm working on migrating Google Play Billing to 5.0.0 by using Flutter in_app_purchase 3.0.7 as I raised the question here. Migrate to Billing 5.0.0
It seems that Play Console still raises warning with in_app_purchase 3.0.7. The workaround is to add com.google.android.play.billingclient.version in AndroidManifest.xml as mentioned here link. When I did that, it got rid of the warning but unfortunately it causes App crashes with following error:
E/AndroidRuntime( 9885): java.lang.NoSuchMethodError: No virtual method setReplaceSkusProrationMode(I)Lcom/android/billingclient/api/BillingFlowParams$Builder; in class Lcom/android/billingclient/api/BillingFlowParams$Builder; or its super classes (declaration of 'com.android.billingclient.api.BillingFlowParams$Builder' appears in /data/app/~~T2Kh46nWychg2xWUZiO5EA==/com.blueedgez.paintover-IPoCtqgP0Ez5df07rfzPyw==/base.apk!classes2.dex)
E/AndroidRuntime( 9885): at io.flutter.plugins.inapppurchase.MethodCallHandlerImpl.launchBillingFlow(MethodCallHandlerImpl.java
I tried with Billing version 4.0.0 but got the same error.
I cleaned all the cache before I executed the build and this is what flutter doctor looks like.
[√] Flutter (Channel stable, 3.3.4, on Microsoft Windows [Version 10.0.18363.592], locale en-US)
• Flutter version 3.3.4 on channel stable at C:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision eb6d86ee27 (6 days ago), 2022-10-04 22:31:45 -0700
• Engine revision c08d7d5efc
• Dart version 2.18.2
• DevTools version 2.15.0
[√] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
• Android SDK at C:\Users\Jay\AppData\Local\Android\sdk
• Platform android-33, build-tools 32.0.0
• Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[!] Visual Studio - develop for Windows (Visual Studio Community 2022 17.2.1)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.2.32516.85
X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++"
workload, and include these components:
MSVC v142 - VS 2019 C++ x64/x86 build tools
- If there are multiple build tool versions available, install the latest
C++ CMake tools for Windows
Windows 10 SDK
[√] Android Studio (version 2020.3)
• Android Studio at C:\Program Files\Android\Android Studio2
• 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)
[√] Android Studio (version 4.1)
• Android Studio at C:\Program Files\Android\Android Studio1
• 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)
[√] VS Code (version 1.64.2)
• VS Code at C:\Users\Jay\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.17.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.18363.592]
• Chrome (web) • chrome • web-javascript • Google Chrome 106.0.5249.103
• Edge (web) • edge • web-javascript • Microsoft Edge 104.0.1293.70 (unsupported)
[√] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
Appreciate any feedback.

throw PlatformException error when trying to use Google Authentication

I am trying to use google authentication to log in to my app. Previously, I had this code running perfectly on my other laptop, but now that I have moved the same code and setup to another machine I am facing issues.
I have added SHA1 and SHA256 keys into my firebase, added the google-services.json file in my app folder. Currently, when I click my button to sign in with google, it shows me my account and let's me click it. However, upon clicking, it automatically redirects me to the messages_codecs.dart file and highlights this line throw PlatformException(code: errorCode, message: errorMessage as String?, details: errorDetails, stacktrace: errorStacktrace);
I was initially facing this identical error upon clicking on my sign in button, but then realized I was not using a AVM with google play store enabled. After changing that, it brings me through the sign in process, but after gives the same error.
You can find my whole file structure here. It is inside this question - StreamBuilder issue - snapshot.connectionState == ConnectionState.waiting when a TextFormField widget is clicked.,
I have searched and tried every solution online but nothing seems to work
Here is my flutter doctor -v
[√] Flutter (Channel master, 3.1.0-0.0.pre.966, on Microsoft Windows [Version 10.0.22000.613], locale en-US)
• Flutter version 3.1.0-0.0.pre.966 at C:\Users\aryan\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision df52b510ca (18 hours ago), 2022-05-27 06:13:06 -0400
• Engine revision 436f18b5a2
• Dart version 2.18.0 (build 2.18.0-149.0.dev)
• DevTools version 2.13.1
[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
• Android SDK at C:\Users\aryan\AppData\Local\Android\sdk
• Platform android-32, build-tools 32.1.0-rc1
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
• 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 2019 16.7.5)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.7.30523.141
• Windows 10 SDK version 10.0.18362.0
X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components:
MSVC v142 - VS 2019 C++ x64/x86 build tools
- If there are multiple build tool versions available, install the latest
C++ CMake tools for Windows
Windows 10 SDK
[√] Android Studio (version 2021.2)
• 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.12+7-b1504.28-7817840)
[√] VS Code (version 1.67.2)
• VS Code at C:\Users\aryan\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.40.0
[√] Connected device (4 available)
• sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22000.613]
• Chrome (web) • chrome • web-javascript • Google Chrome 102.0.5005.61
• Edge (web) • edge • web-javascript • Microsoft Edge 101.0.1210.53
[√] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.

Vscode showing white theme/text in my flutter dart code

In the image above you can see that the whole dart code is showing white lines and this happened after my laptop accidently turned off while I was running the code.
The first error it gave was corrupted .git/packed-ref file which i fixed but this one isn't going away, other file type is showing their repective color theme only the .dart file is doing this. and also dart analyzer isn't working too
//Flutter doctor -v
[√] Flutter (Channel stable, 2.8.0, on Microsoft Windows [Version 6.3.9600], locale en-US)
• Flutter version 2.8.0 at D:\flutter\Sdk\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision cf44000065 (8 weeks ago), 2021-12-08 14:06:50 -0800
• Engine revision 40a99c5951
• Dart version 2.15.0
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc2)
• Android SDK at C:\Users\bright\AppData\Local\Android\sdk
• Platform android-31, build-tools 31.0.0-rc2
• Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• 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.
[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio1
• Flutter plugin version 44.0.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[√] VS Code (version 1.63.2)
• VS Code at C:\Users\bright\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.34.0
[√] Connected device (1 available)
• Edge (web) • edge • web-javascript • Microsoft Edge 97.0.1072.69
! Doctor found issues in 1 category.
I don't exactly know what the problem is, since it isn't showing me any error. Please what do i do?
I think there is something wrong with the Dart extension (perhaps some files are corrupt), but uninstalling/re-installing it does not remove the files from disk and re-download it.
I would try uninstalling the Dart extension, then go into your %USERPROFILE%\.vscode\extensions folder and delete any dart-code.dart-code folders, and then re-launch VS Code and re-install it.
If that doesn't solve it, please file an issue at https://github.com/Dart-Code/Dart-Code. Thanks!

Problem with AltGr key in flutter Windows desktop

In any Flutter app in a TextField widget, on Windows, pressing once the AltGr key will drive Windows keyboard crazy: after pressing AltGr, Windows behaves as if the ctrl key was pressed continuously in any application. (Pressing a simple v behaves like if the ctrl-v was pressed) Just double-pressing the left ctrl key will stop this strange state.
Thus, no Windows application written in flutter can be published because if the user presses the AltGr key, he will not understand why his keyboard will not work in any other application afterwards.
It can be reproduced every time, in every environment. On other Windows too. On other machine too. In release exe version too. E.g. in StaleFulWidget, and a TextField in it.
Could somebody help me to solve this very serious Flutter bug? Thank you in advance.
Windows version: Win 10 Pro 20H2 (build:19042.870) Hungarian version. In Hungarian keyboard the # key is AltGr+v. So users can not type any email address.
Flutter versions:
Flutter is already up to date on channel beta
Flutter 2.1.0-12.2.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 5bedb7b1d5 (6 days ago) • 2021-03-17 17:06:30 -0700
Engine • revision 711ab3fda0
Tools • Dart 2.13.0 (build 2.13.0-116.0.dev)
Flutter doctor is perfect.
C:\flutter\bin\flutter.bat doctor --verbose
[√] Flutter (Channel beta, 2.1.0-12.2.pre, on Microsoft Windows [Version 10.0.19042.870], locale hu-HU)
• Flutter version 2.1.0-12.2.pre at C:\flutter
• Framework revision 5bedb7b1d5 (6 days ago), 2021-03-17 17:06:30 -0700
• Engine revision 711ab3fda0
• Dart version 2.13.0 (build 2.13.0-116.0.dev)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\zsmik\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• 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 2019 16.9.2)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.9.31112.23
• Windows 10 SDK version 10.0.18362.0
[√] Android Studio (version 4.1.0)
• 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 1.8.0_242-release-1644-b01)
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19042.870]
• Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.90
• Edge (web) • edge • web-javascript • Microsoft Edge 89.0.774.57
• No issues found!
As of December 6 2021, this is fixed on the master channel.
If you don't want other projects to be affected, you can use https://pub.dev/packages/fvm to use that channel on a per-project level:
activate the tool, running dart pub global activate fvm in your project directory
run fvm use master
run your app using fvm flutter run, or specify the flutter SDK symlinked in your project folder within the ".fvm" directory for your IDE to use for compiling the app.