Installing Flutter on Mac OS - android

on running flutter doctor i get the below dependency lacking :
Android toolchain - develop for Android devices (Android SDK 28.0.3)
Could not determine java version
Android Studio (not installed)
But i have already installed both and developing apps on Android Studio.Then why flutter is not able to find these two?
It is complaining for the jre version as well.But internally Android Studio uses the jre which is already installed with it.
flutter doctor -v gives below output :
[✓] Flutter (Channel stable, v1.0.0, on Mac OS X 10.13.6 17G65, locale en-IN)
• Flutter version 1.0.0 at /Users/<myusername>/Downloads/development/flutter
• Framework revision 5391447fae (3 months 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 /Users/<myusername>/Library/Android/sdk
• Android NDK at /Users/<myusername>/Library/Android/sdk/ndk-bundle
• Platform android-28, build-tools 28.0.3
• Java binary at: /usr/bin/java
✗ Could not determine java version
[!] iOS toolchain - develop for iOS devices
✗ 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
• ios-deploy 1.9.4
• CocoaPods version 1.6.0
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.io/setup/#android-setup for detailed instructions).
[!] Connected device
! No devices available

Solution for Xcode:
Install Xcode (get it from https://developer.apple.com/xcode/)
Ensure Xcode app is in the /Applications directory (NOT /Users/{user}/Applications).
Point xcode-select to the Xcode app Developer directory using the following command:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
Note: Make sure your Xcode app path is correct.
Xcode: /Applications/Xcode.app/Contents/Developer
Xcode-beta: /Applications/Xcode-beta.app/Contents/Developer

Related

Having a problem with Flutter Doctor on Arch Linux

I am running Arch Linux.
I have a problem where flutter doctor doesn't recognize my Android Sdk.
My Flutter Doctor output:
[✓] Flutter (Channel stable, 2.10.3, on Arch Linux 5.16.15-arch1-1, locale en_US.UTF-8)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 2021.1)
[✓] Android Studio
[!] Connected device
! No devices available
[✓] HTTP Host Availability
! Doctor found issues in 3 categories.
Here is a more detailed summary:
[✓] Flutter (Channel stable, 2.10.3, on Arch Linux 5.16.15-arch1-1, locale en_US.UTF-8)
• Flutter version 2.10.3 at /home/tt/Downloads/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7e9793dee1 (3 weeks ago), 2022-03-02 11:23:12 -0600
• Engine revision bd539267b4
• Dart version 2.16.1
• DevTools version 2.9.2
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 2021.1)
• Android Studio at /home/tt/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/211.7628.21.2111.8193401
• Flutter plugin version 65.2.2
• Dart plugin version 211.7808
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
[✓] Android Studio
• Android Studio at /opt/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.11+0-b60-7590822)
[!] Connected device
! No devices available
[✓] HTTP Host Availability
• All required HTTP hosts are available
As you can see, it doesn't recognize my Android Sdk.
I tried this:
flutter config --android-sdk /home/tt/Android/Sdk/platforms/android-32/android.jar
and I got:
Setting "android-sdk" value to "/home/tt/Android/Sdk/platforms/android-32/android.jar".
You may need to restart any open editors for them to read new settings.
I ran flutter doctor but didn't work. I restarted my machine and it still doesn't work.
I already had Android Studio from the Toolbox Application. I tried installing it from the .tar.gz version. Still doesn't work. I installed from the AUR, but nothing works.
Can you please help..
Try to set ANDROID_HOME in your environment variable.
On ~/.bashrc of you are using bash or ~/.zshrc if you are using zsh in the last line put
export ANDROID_HOME=[SDK-PATH]
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
I believe the problem is in the PATH of Android SDK Command-Line Tools and Android SDK Build Tools.
Put the following lines at the end of the ~/.bachrc file:
export ANDROID_HOME="/home/XXX/Android/Sdk/"
export PATH="$PATH:${ANDROID_HOME}cmdline-tools/latest/bin/:${ANDROID_HOME}build-tools/33.0.0/:${ANDROID_HOME}platform-tools/"
Note that XXX, latest, and 33.0.0 must be changed according to your installation.

Unable to create Dart Project in Android Studio 4.0

I have installed Android studio v4.0.1 on my MAC.
When i try to create a new project in android studio via File->New->NewProject->BasicActivity I couldn't find dart in language option for new project. Basically, I am trying to create a new dart project.
Below is the doctor output: Under Android studio, flutter and dart seems to be ticked and ok.
mboobesh$ flutter doctor -v
[✓] Flutter (Channel stable, v1.17.5, on Mac OS X 10.14.6 18G6020, locale en-IN)
• Flutter version 1.17.5 at /Users/mboobesh/Documents/Dev/flutter
• Framework revision 8af6b2f038 (5 weeks ago), 2020-06-30 12:53:55 -0700
• Engine revision ee76268252
• Dart version 2.8.4
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
• Android SDK at /Users/mboobesh/Library/Android/sdk
• Platform android-30, build-tools 30.0.1
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• 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:
sudo gem install cocoapods
[✓] Android Studio (version 4.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 47.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[!] IntelliJ IDEA Community Edition (version 2020.2)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
✗ 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.dev/intellij-setup/#installing-the-plugins
[!] Connected device
! No devices available
! Doctor found issues in 3 categories.
:~
Moreover, if i go to android studio preferences, there i could see Dart and its SDK path. Plugins are showing that Flutter and Dart are installed and up to date.
Additionally, I have installed intelliJ separately in my Mac, where i could see Dart in new project selection. Am i missing something to install in Android studio? that is why it is not showing Dart language in new project settings? please help.
just add Flutter to your androidStudio plugin go to :
Start Android Studio.
Open plugin preferences " preference->plugin " (Configure > Plugins as of v3.6.3.0 or later).
Select the Flutter plugin and click Install.
Click Yes when prompted to install the Dart plugin.
Click Restart when prompted.
that's all !
You are trying to create Flutter project as I understand.There is no Dart project. There is Flutter project which uses dart language. You need to install flutter plug-in on android studio. and there will be create new flutter project option.
This is from where you are creating flutter project:
If this option is not there that means you have not installed flutter plugin on android studio.
https://flutter.dev/docs/get-started/editor Check this out if there is not this option.

Device not applicable for the “main.dart” configuration

Before anyone points me to this link I would like to mention, that I don't think these are directly related.
As one can see my flutter doctor -v command is error free:
➜ flutter git:(stable) flutter doctor -v
[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Mac OS X 10.15.3 19D76, locale en-US)
• Flutter version 1.12.13+hotfix.9 at /Users/johannes/.flutter-cli/flutter
• Framework revision f139b11009 (5 weeks ago), 2020-03-30 13:57:30 -0700
• Engine revision af51afceb8
• Dart version 2.7.2
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/johannes/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.4.1, Build version 11E503a
• CocoaPods version 1.8.4
[✓] Android Studio (version 3.6)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 45.1.1
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[✓] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• No issues found!
Yet I to have the issue of a grayed out emulator device with the message Device not applicable for the “main.dart” configuration like this:
I can now only start the emulator using the dropdown menu <no device> like this:
Interestingly I am then actually able to run my app on the device, while the device is still grayed out:
Flutters hot-reloading feature seems to not work properly though.
I have already added the main folder to the project as suggested here and I also made sure to change NO SDK to ANDROID API PLATFORM as suggested in the same link. All dependencies in Project Structure > Modules are found by Android Studio. I cloned the Flutter SKD from the stable branch on GitHub.
Does anyone have an idea why my setup is behaving this way?
Close Android Studio and Run again as Administrator
It solved my problem:
1- Make sure Flutter plugin is installed in android studio, you can install the plugin from file > setting > plugin
2- choose flutter SDK path from File > setting> Language & Framework > flutter.
I have the same issue before.
Uninstall Flutter and Dart plugin from Android Studio then reinstall Flutter (Dart will be installed automatically)
Remove created emulators from AVD Manager and create new one
Try making new project, and set SDK version same as emulators API version or lower from File > Project Structure...
Hopefully worked for you.

Flutter release APK build - Intermittent white screen

My app works perfectly on the Android emulator. When I create a release APK I get this error:
Intermittently, the Scaffold content does not load. The Nav bar and drawer are visible, but not the central content.
This does not happen every time I open the app, only about 1/3 times, on average. There is no obvious pattern to this working or failing.
[✓] Flutter (Channel stable, v1.12.13+hotfix.7, on Mac OS X 10.11.6 15G22010,
locale en)
• Flutter version 1.12.13+hotfix.7 at /Applications/flutter
• Framework revision 9f5ff2306b (3 days ago), 2020-01-26 22:38:26 -0800
• Engine revision a67792536c
• Dart version 2.7.0
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/dan/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling
support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)
• 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:
sudo gem install cocoapods
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 42.1.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)
[✓] VS Code (version 1.41.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.7.1
[✓] Connected device (1 available)
• klte • 5d3f96b0 • android-arm • Android 7.1.2 (API 25)
I have a similar case, the scaffold is not drawn, it is as if it were empty, for the moment the solution I found was to generate the apk but in debug mode, change flutter build apk --release to flutter build --debug .

Flutter.dev and the problem with macOS Catalina (Gatekeeper)

since I upgraded my MacBook to macOS Catalina. I'm getting permanent the message ("ideviceinfo" could not be open, because the developer is not verified) despite I disabled the "spctl". can somebody help please?
I downloaded the flutter version flutter_macos_v1.9.1+hotfix.4-stable.zip AND i use the Andriod Studio 3.5.1.
[✓] Flutter (Channel stable, v1.9.1+hotfix.4, on Mac OS X 10.15 19A583, locale de-DE)
• Flutter version 1.9.1+hotfix.4 at /Users/yousefmosa/0/prg/flutter
• Framework revision cc949a8e8b (2 weeks ago), 2019-09-27 15:04:59 -0700
• Engine revision b863200c37
• Dart version 2.5.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/yousefmosa/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.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_202-release-1483-b49-5587405)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[!] Xcode - develop for iOS and macOS (Xcode 11.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.0, Build version 11A420a
✗ 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:
sudo gem install cocoapods
pod setup
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 40.1.2
• Dart plugin version 191.8423
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] IntelliJ IDEA Community Edition (version 2019.1.3)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 37.0.3
• Dart plugin version 191.7830
[✓] VS Code (version 1.37.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.3.0
[✓] Connected device (1 available)
• iPhone 11 Pro Max • XXX-6B2F-XXX-9B01-XXXXXX • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-0 (simulator)
! Doctor found issues in 2 categories.
From macOS "System Preferences..." > "Security & Privacy" > "General" tab ,
you see the dart entry. Just press "Allow Anyway"
Go to System preferences -> General and allow "dart" to run
Type these command in terminal
sudo xattr -d com.apple.quarantine YourflutterSDKLocation/bin/cache/artifacts/libimobiledevice/ideviceinfo
This is because of recent changes in macOS Catalina.
sudo spctl --add "Path_to_flutter/bin/cache/artifacts/libimobiledevice/ideviceinfo"
You might need to reboot the system in order to apply the changes.
You can run a GateKeeper script to fix the issue.
I have published an article with more information how to fix this.

Categories

Resources