Flutter I can't release or debug when I add Connectivity - flutter

SOLUTION for this problem
I deleted the JDK 13. I installed JDK 8.
I gave the environment variable for the Flutter SDK. in user variables
flutter
C: \ flutter \ bin
I gave the environment variable for JAVA_HOME. in system variables
JAVA_HOME
C: \ Program Files \ Java \ jdk1.8.0_241
Then I accepted Android licenses with cmd.
(flutter doctor --android-licenses)
Now I can use flutter connectivity.
The problem is solved. Thank you.
-------------------------------------------------
I cannot debug or release to my app when I add Connectivity to my app's pubspec.yaml
Flutter Doctor
[flutter] flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18363.657], locale tr-TR)
• Flutter version 1.12.13+hotfix.8 at C:\flutter
• Framework revision 0b8abb4724 (9 days ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\Faruk Aydin\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: C:\Program Files\Java\jdk-13.0.2\bin\java
• Java version Java(TM) SE Runtime Environment (build 13.0.2+8)
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.5)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 42.1.1
• Dart plugin version 191.8593
X Unable to find bundled Java version.
• Try updating or re-installing Android Studio.
[√] VS Code (version 1.42.1)
• VS Code at C:\Users\Faruk Aydin\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.8.1
[√] Connected device (1 available)
• Redmi 8A • f12007c00606 • android-arm • Android 9 (API 28)
! Doctor found issues in 2 categories.
exit code 0

I deleted the JDK 13. I installed JDK 8.
I gave the environment variable for the Flutter SDK. in user variables
flutter
C: \ flutter \ bin
I gave the environment variable for JAVA_HOME. in system variables
JAVA_HOME
C: \ Program Files \ Java \ jdk1.8.0_241
Then I accepted Android licenses with cmd.
(flutter doctor --android-licenses)
Now I can use flutter connectivity.
The problem is solved. Thank you.

You need to create a global file under your username in Mac. Just create a .bashprofile file as described bellow:
Open to see location and locate your flutter sdk inside.

Related

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

Why does every code related to font_awesome_flutter package gives an error including the import package code?

SITUATION
I made a project in another device and when I am using the same project in another device. It gives an font_awesome_flutter package error all over the code. And gives an error saying, Target of URI doesn't exist: 'package:font_awesome_flutter/font_awesome_flutter.dart'.
Try creating the file referenced by the URI, or Try using a URI for a file that does exist. Same issue occurs in vs code as well as in android studio
How should I tackle this?
TRIED
I also tried running flutter pub get but does not work.
pubspec.yaml file
dependencies:
flutter:
sdk: flutter
font_awesome_flutter: ^8.8.1
cupertino_icons: ^0.1.3
flutter doctor -v seems good too.
PS G:\Current Work\nikeshoeapp-20200809T055655Z-001\nikeshoeapp> flutter doctor -v
[√] Flutter (Channel stable, 1.20.1, on Microsoft Windows [Version 10.0.19041.388], locale en-US)
• Flutter version 1.20.1 at C:\src\flutter\flutter
• Framework revision 2ae34518b8 (3 days ago), 2020-08-05 19:53:19 -0700
• Engine revision c8e3b94853
• Dart version 2.9.0
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
• Android SDK at C:\Users\Aman Chaudhary\AppData\Local
• Platform android-30, build-tools 30.0.1
• 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.
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 48.0.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.47.3)
• VS Code at C:\Users\Aman Chaudhary\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.13.2
[√] Connected device (1 available)
• sdk gphone x86 arm (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• No issues found!
Please Let me know what should I try?
Try file -> invalidate/restart and then click on invalidate and restart.
If it doesn't work, try running this
’’’
flutter clean pub cache
’’’
I also faced this problem, in my case i finished my project and done a
flutter clean and done flutter build apk --release
and the error was
Target of URI doesn't exist: 'package:font_awesome_flutter/font_awesome_flutter.dart'. Try creating the file referenced by the URI, or Try using a URI for a file that does exist.
Solution
These commands saved me
flutter clean
flutter packages get
flutter pub get
flutter build apk --release
Still i didn't get the difference between flutter packages get and flutter pub get

Flutter SDK is not authorized by AVD

I'm running Android studio as an administrator in Windows 10. The AVD is a Nexus 5X API 28. I'm trying to run the flutter demo, but the device drop-box still shows "no devices", it only has the "Open Android Emulator" option, which I clicked to start the AVD:
The output of
flutter doctor -v
is:
[√] Flutter (Channel stable, v1.0.0, on Microsoft Windows [Version 10.0.17134.407], locale en-US)
• Flutter version 1.0.0 at C:\Users\User\flutter_windows_v1.0.0-stable\flutter
• Framework revision 5391447fae (10 days ago), 2018-11-29 19:41:26 -0800
• Engine revision 7375a0f414
• Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.3)
• Android SDK at C:\Users\User\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
• All Android licenses accepted.
[√] Android Studio (version 3.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 31.1.1
• Dart plugin version 181.5656
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
[!] Connected device
• Device emulator-5554 is not authorized.
You might need to check your device for an authorization dialog.
! Doctor found issues in 1 category.
Unlike in a real phone connected via USB, here there is no authorization dialog when I start the AVD. How can I authorize the phone?
This simple solution worked: Wipe data and Cold Boot.
Didn't work:
Note that in the Terminal of the Android studio, adb is not recognized (following flutter installation instructions). You can add the android SDK location path to the PATH environmental variable just to be able to run adb, but this won't give you more information than flutter doctor -v. The android SDK path should be already in Tools|SDK Manager, which is in my case "C:\Users\User\AppData\Local\Android\Sdk", nothing to do with "android-sdk-windows". Killing and restarting adb didn't work.
Logcat shows the message "Please configure Android SDK" (click on "configure", opens "Project Structure" window). The paths to SDK and default JDK are valid. Installing NDK miscofigured something else, so I uninstalled it and left this path field empty. Under "Project", all Version and Repository fields are empty.
You should add ANDROID_HOME variable to your class_path
set ANDROID_HOME=C:\<installation location>\android-sdk-windows
set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
Taken from this
After that call flutter doctor -v and flutter devices

Unable to locate a development device; please run 'flutter doctor' .. but doctor checks out ok

A new installation of flutter/dart went smoothly without issue .. running "flutter doctor -v" gives the following output:
$ flutter doctor -v
[✓] Flutter (Channel beta, v0.11.9, on Linux, locale en_AU.UTF-8)
• Flutter version 0.11.9 at /home/jedaa/bin/flutter
• Framework revision d48e6e433c (3 days ago), 2018-11-20 22:05:23 -0500
• Engine revision 5c8147450d
• Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.2)
• Android SDK at /home/jedaa/bin/Android/sdk
• Android NDK location not configured (optional; useful for native
profiling support)
• Platform android-28, build-tools 28.0.2
• ANDROID_HOME = /home/jedaa/bin/Android/sdk
• Java binary at: /opt/android314/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-
b06)
• All Android licenses accepted.
[✓] Android Studio (version 3.2)
• Android Studio at /opt/android314
• Flutter plugin version 30.0.1
• Dart plugin version 181.5656
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-
b06)
[✓] IntelliJ IDEA Community Edition (version 2018.2)
• IntelliJ at /opt/idea
• Flutter plugin version 30.0.2
• Dart plugin version 182.5124
[✓] VS Code (version 1.29.1)
• VS Code at /usr/share/code
• Flutter extension version 2.20.0
[!] Connected device
! No devices available
! Doctor found issues in 1 category.
and yet attempting to run the defalut starter app "flutter/material.dart" results in ... "Unable to locate a development device; please run 'flutter doctor' for information about installing additional components" ... irrespective whether i use Intellij or Visual Studio.
However,
$ flutter devices
1 connected device:
Pixel XL • HT69R0205363 • android-arm64 • Android 9 (API 28)
I have searched the web and found similar complaints .. but no solution. I was hoping that someone might be able to throw some light on this as I am sure it must be something simple and straight forward.
Visual Studio is a new installation but I have been using Intellij now for 6 months on a daily basis and rarely have issue with it .. especially one that i cannot fix. :)
Thank you in advance.
open Terminal in Android Studio or VS Code.
and writes this command :
flutter config --android-sdk <sdk-location>
SDK-location is your Path for SDK! for Example :
flutter config --android-sdk /home/sanaebadi/Pasport/programming/and_dev/sdk/sdk-tools-linux-3859397/
I had the same problem , then I tried this solution , and it helped me and my flutter app is running on my phone ..
all you need to do is install Android API level 29 (Android 9.0+ "Q")
go to Setting > Android SDK >SDK platform>Check Android 9+ and Press Apply button
I found this solution from github .. her is the link ..
Hope this help you
https://github.com/flutter/flutter/issues/22649#issuecomment-520472515
In Android Studio, ensure that the API level of your Project SDK (File->Project Structure) <= of the API level of your AVD.

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