Dart in Android Studio. No device to run applicaton - android

I can't run application because there is no devices on the list.
I tried to create AVD and connect real device. I have installed curl, Android SDK path was set, flutter licenses were accepted. I have Ubuntu 16.04.4
Output of flutter run --verbose in projects directory :
flutter: command not found
I have flutter path:
$ export PATH=/home/joe/flutter/bin:$PATH
$ echo $PATH
/home/joe/flutter/bin:home/joe/flutter/bin:home/joe/flutter/bin:/home/joe/bin:/home/joe/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
Now I put path's to .bashrc and run source ~/.bashrc, did I put path's correct way ?
# set PATH so it includes user's private bin directories
export PATH=/home/joe/flutter/bin:$PATH
export ANDROID_HOME=$HOME/Android/SDK
export PATH=$PATH:$ANDROID_HOME/tools
After adding path's to .bashrc I run flutter doctor:
$ /home/joe/flutter/bin/flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel master, v0.5.7-pre.102, on Linux, locale en_US.UTF-8)
✗ Downloaded executables cannot execute on host.
See https://github.com/flutter/flutter/issues/6207 for more information
On Debian/Ubuntu/Mint: sudo apt-get install lib32stdc++6
On Fedora: dnf install libstdc++.i686
On Arch: pacman -S lib32-libstdc++5
[✗] 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.io/setup/#android-setup for detailed instructions).
If Android SDK has been installed to a custom location, set $ANDROID_HOME to that location.
[✓] Android Studio (version 3.1)
[!] IntelliJ IDEA Community Edition (version 2018.1)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
[!] Connected devices
! No devices available
! Doctor found issues in 4 categories.

Can be easily fixed by setting project SDK to latest Android API.
Go to File
Project Structure
Under Project-SDK select the latest SDK installed(Example:- Android API 29 Platform).

You have to set an Environment variable.
You can check it here for Flutter SDK setup with Android Studio

Related

Flutter can't recognize android sdk

I'm running Ubuntu 20 and trying to setup flutter enironment without android studio. Installed android sdk manually && it's path is $HOME/android.
here's a log of the directory
$ ls
# cmdline-tools licenses
$ ls cmdline-tools/
# latest tools
ls cmdline-tools/latest
bin lib NOTICE.txt package.xml source.properties
And here's sys vars which are in ~/.bashrc
export ANDROID_SDK_ROOT="$HOME/android"
export ANDROID_HOME="$ANDROID_SDK_ROOT"
export PATH="$PATH:$ANDROID_SDK_ROOT"
export PATH="$PATH:$ANDROID_SDK_ROOT/cmdline-tools/tools"
export PATH="$PATH:$ANDROID_SDK_ROOT/cmdline-tools/tools/bin"
export PATH="$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin"
export PATH="$PATH:$ANDROID_SDK_ROOT/cmdline-tools/tools/platform-tools"
export PATH="$PATH:$ANDROID_SDK_ROOT/platform-tools"
export PATH="$PATH:$ANDROID_SDK_ROOT/build-tools"
And here's flutter doctor - v log
[!] Android toolchain - develop for Android devices
• Android SDK at /home/aybak3k/android/
✗ 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.
• ANDROID_HOME = /home/aybak3k/android/
• ANDROID_SDK_ROOT = /home/aybak3k/android
✗ Android SDK file not found: adb.
• Try re-installing or updating your Android SDK,
visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions.
Probably because is missing /sdk
Try to change export ANDROID_SDK_ROOT="$HOME/android"
to export ANDROID_SDK_ROOT="$HOME/android/sdk"
if not work, try to check the full path to platform-tools
run which adb
$HOME/android/sdk/platform-tools/adb
flutter can't recognize the sdk unless you install the rest of the components
the following worked
# 30 is my physical device compatible version
sdkmanager --install "build-tools;30.0.2"
sdkmanager --install "platforms;android-30"

Exception: Unable to generate build files in flutter

I am trying to install flutter in kali linux machine. I installed flutter from official website and followed accordingly. I don't want to use android studio so I am using visual studio code.
when I run Flutter doctor in terminal i get
[✓] Flutter (Channel master, 2.2.0-11.0.pre.161, on Linux, locale en_IN)
[✗] 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.
[☠] Linux toolchain - develop for Linux desktop (the doctor check crashed)
✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at
https://github.com/flutter/flutter/issues.
✗ ProcessException: Failed to find "ninja" in the search path.
Command: ninja
[!] Android Studio (not installed)
[✓] VS Code (version 1.55.2)
[✓] Connected device (1 available)
! Doctor found issues in 4 categories.
And when i Run in visual studio i get this
Launching lib/main.dart on Linux in debug mode...
lib/main.dart:1
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
Exception: Unable to generate build files
Exited (sigterm)
Can anyone help me with this issue please.
I found the solution by using this following command:
sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev
and
flutter config --enable-linux-desktop
you must install ninja.
sudo pacman -S ninja or sudo apt-get install ninja.

Flutter don't recognize ANDROID_HOME neither ANDROID_SDK_ROOT

I installed android-sdk and flutter-git on Manjaro with AUR. I set and exported the vars ANDROID_HOME and ANDROID_SDK_ROOT === /opt/android-sdk.
However, when I run flutter doctor the android sdk seems to not been recognized.
I will use flutter on vs-code.
How can I set up all this correctly?
What I did:
export ANDROID_HOME=/opt/android-sdk/
export ANDROID_SDK_ROOT=/opt/android-sdk/
Flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 1.19.0-4.0.pre.75, on Linux, locale
en_CA.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-setu
p for detailed instructions).
If the Android SDK has been installed to a custom location, set
ANDROID_SDK_ROOT to that location.
You may also want to add it to your PATH environment variable.
[!] Android Studio (not installed)
[!] Connected device
! No devices available
! Doctor found issues in 3 categories.
Run Android Studio, create a new project and run it
The main problem was the jdk version, I was using version 10. The recommend one is version 8 because the java.se.ee class.
Steps
Use this command or use the "Add/Remove Softare"
yaourt -S flutter-bin android-sdk android-sdk-platform-tools
Choose the open jdk 8 and run all commands below:
sudo chown -R $USER:$USER /opt/*
flutter precache && flutter doctor
If "Android Licenses are unkown", run flutter doctor --android-licenses
These steps will automatically set all env vars such as "ANDROID_HOME" but if you get any error, export them using the path to android-sdk, that will be /opt/android-sdk/

Android SDK file not found: adb on MacOSX

On MacOSX, when I run flutter doctor, the following result is shown in the terminal:
[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.14.5 18F132, locale pt-BR)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
✗ Android SDK file not found: adb.
[✗] 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.6)
[!] VS Code (version 1.40.2)
✗ Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Connected device
! No devices available
! Doctor found issues in 4 categories.
The line following error is strange.
[!] Android toolchain - develop for Android devices (Android SDK
version 29.0.3)
✗ Android SDK file not found: adb.
Android SDK is installed
Platform tools are installed
If I run adb devices on my terminal, everything works fine and my device appears.
Any idea on how to fix this?
So I fixed in a very strange way:
Seems like some new version of Android SDK moved adb from /sdk/platform-tools to /sdk/platform-tools/platform-tools
To fix, I've only moved adb from /sdk/platform-tools/platform-tools to /sdk/platform-tools and now it's working.
Starting with the less complex fix;
Open vscode, click on the extension tab then search and install flutter extension.
Open the App Store search and install Xcode. It takes a very long time to complete. Clearly your installation is not complete.
If you are sure you have android SDK downloaded, then use the following command to provide the path the android studio. flutter config --android-sdk <path-to-your-android-sdk-path>
. Else you can use android studio to download the required Android SDK. See location in picture
Installing Xcode in the App store will install cocaopods. Then try flutter doctor -v and everything will be good.
NOTE: you don't need adb in mac for flutter to compile on android. downloading an Android SDK will install qemu. You will also notice some significate process load while running an Android emulator because of the running qemu process since it is not very optimized fro mac. But that is not an issue you will get use to or just use a real android device. Install Xcode will install all Iphones simulators.

Failed to move away or delete existing target C:\androidSDK\sdk\tools

i can't update the sdk tools, i don't know why, if use this command "sdkmanager --update" or "android update sdk" it will give me error like this title :
Warning: An error occured during installation: Failed to move away or delete existing target file: C:\androidSDK\sdk\tools
big thanks if you can help me!
1) Rename C:\Users\%username%\AppData\Local\Android\Sdk\tools folder to tool
2) Navigate to cd C:\Users\%username%\AppData\Local\Android\Sdk\tool\bin in cmd
3) And run sdkmanager --update --verbose, will create a new folder tools
4) Run flutter doctor --android-licenses
5) Then Accept the android licenses by clicking y
6) flutter doctor command will show the following:
Kishore Kumar#Kishore MINGW64 ~$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.7.3, on Microsoft Windows [Version 10.0.17134.228], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK 25.0.2)
[√] Android Studio (version 3.1)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] Connected devices (1 available)
• No issues found!
Here is how i solved this problem:
First, I renamed AndroidSDK\tools to AndroidSDK\tool.
Then, I set the windows' environment variable Path from AndroidSDK\tools to AndroidSDK\tool (maybe not necessary)
Run sdkmanager --update in tool\bin .
Ignore the warning and wait until the update is done.
There will be a new folder named tools in AndroidSDK.
Copy all the files in tools folder and paste them to tool folder.
Overlay all the files that which has the same name in tool folder.
Finally,delete tools folder and rename tool to tools.
Problem solved.

Categories

Resources