• 13

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Android SDK cannot be found by flutter

I have installed flutter through AUR. I also have aur/android-sdk 26.0.2-1 installed. When I run flutter run I get:

Warning! This package referenced a Flutter repository via the .packages file that is
no longer available. The repository from which the 'flutter' tool is currently
executing will be used instead.
  running Flutter tool: /home/dair/.flutter-sdk
  previous reference  : /home/dair/flutter
This can happen if you deleted or moved your copy of the Flutter repository, or
if it was on a volume that is no longer mounted or has been mounted at a
different location. Please check your system path to verify that you are running
the expected version (run 'flutter --version' to see which flutter is on your path).

Unable to locate a development device; please run 'flutter doctor' for information about installing additional components.

Firstly, I ran flutter --version, and received:

Flutter • channel alpha • https://github.com/flutter/flutter.git
Framework • revision e2f54df5ab (9 days ago) • 2017-06-02 10:43:54 -0700
Engine • revision 1f2aa07571
Tools • Dart 1.24.0-dev.3.0

Not sure what exactly it means by "to see which flutter is on your path". Next I ran flutter doctor and got:

[?] Flutter (on Linux, locale en_US.UTF-8, channel alpha)
    • Flutter at /home/christopher/.flutter-sdk
    • Framework revision e2f54df5ab (9 days ago), 2017-06-02 10:43:54 -0700
    • Engine revision 1f2aa07571
    • Tools Dart version 1.24.0-dev.3.0

[?] Android toolchain - develop for Android devices
    ? ANDROID_HOME = /opt/android-sdk
      but Android SDK not found at this location.

[?] Android Studio (version 2.3)
    • Android Studio at /usr/local/android-studio
    • Gradle version 3.2
    • Java version: OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[?] Connected devices
    • None

However, if I cd into /opt/android-sdk I get:

?  ~ cd /opt/android-sdk 
?  android-sdk ls
add-ons  build-tools  emulator  platforms  tools

So it looks like it is there. The closest question I could find is this one: React Native android build failed. SDK location not found but it seems to be using Mac as opposed to arch as well as some other differences. How can I resolve the flutter doctor and have my app run?

I was running with the same problem when I was trying the flutter doctor command:

enter image description here

The problem is a little clear, it's occurring because the flutter is not founding the path for your Android SDK.

There is two ways to solve it:

  • You can solve this issue setting only for your current terminal instance the SDK path with the following commands:

    flutter config --android-sdk /path/to/android/sdk

    flutter config --android-studio-dir /path/to/android/studio

  • Or to save it forever, exporting the ANDROID_HOME with your Android sdk path.

I solved it exporting the ANDROID_HOME on my machine (Arch Linux, but this works for any Unix instance).

This will solve your issue, But you can need the sdk, platform-tools, tools and the ndk-build paths too (of course, everything need to be installed first) on my profile file (in my case the .zshrc file, the same can be done on your .bashrc and etc.):

#SDK exporting - this will solve your issue
export ANDROID_HOME=/home/{user}/Android/Sdk 

#Tools exporting - it can be need in your case
export PATH=/home/{user}/Android/Sdk/platform-tools:$PATH
export PATH=/home/{user}/Android/Sdk/tools:$PATH
export PATH=/home/{user}/Android/ndk-build:$PATH

#Flutter binary exporting
export PATH=/home/{user}/flutter/bin:$PATH

Then, I reloaded my profile file (that in my is the .zshrc file, use your file in your case .eg .bashrc):

source ~/.zshrc

After that the flutter doctor is running properly.

enter image description here

  • 49
Reply Report

To get the Android SDK path - Open Flutter project in Android Studio - Go to File > Project Structure > SDK Location. Copy the location

To set the Android SDK path - Type in terminal flutter config --android-sdk /path/that/you/just/copied

  • 6
Reply Report
    • Am having the same issue for ios, it was working properly, but now whenever I run flutter doctor, I get this result ? 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 flutter.dev/platform-plugins To install: sudo gem install cocoapods and 'sudo gem install cocoapods' never works

i have solved! i put my android SDK before in F:/androidsdk so when i run "flutter config" android sdk doesnt linked. To link flutter wiht android sdk just type command below:

flutter config --android-sdk /path/to/android/sdk

i just change with this

flutter config --android-sdk F:/androidsdk

i hope this is working.

  • 5
Reply Report

Flutter requires the Android SDK platform tools so that it can use the adb command line tool.

It looks like you've installed the Android SDK but you haven't installed the platform tools yet.

Here is the android-sdk-platform-tools Aur package for arch and a guide for how to install it.

Possibly the error message could be improved to indicate that we are actually missing the Android SDK platform tools rather than the Android SDK itself. If you want to, feel free to send a pull request or open an issue.

  • 1
Reply Report
      • 2
    • Ok thanks! This seems to get me a bit further. I'm going to do a little more debugging to see if I can resolve it completely before I accept. Android studio had a few problems the past couple of days on arch. Typical rolling release model haha.

It is saying that your project is using two different path of flutter-sdk. There are two place where sdk paths are defined.

  1. Setting (Setting > Language&Frameworks > Flutter > Flutter SDK path)

enter image description here

  1. local.properties in your root folder

enter image description here

These both place should contain same path to sdk.Compile with flutter run !! done !!

  • 1
Reply Report

you can simply add

flutter config --android-sdk "path"

in flutter console but because of space on url you should type "your path" to set it correctly

refre image :enter image description here

  • 1
Reply Report

I've set up my Android SDK manually on Windows 10 with the command line, I think this not change a lot in Linux, and I was able to solve this kind of errors while I tried to set up my development environment, if you want to solve it as I did, just follow the next steps that I posted in a GitHub Comment in a related issue:


I hope this can help anyone need it! Bye!

  • 0
Reply Report

in environment variables make Variables: ANDROID_HOME

and add path of SDK get from Andriod stideo --> settings --> SDK Coppy the Path examlpe


Add the SDK path in variables Value: C:\Users\Omar\AppData\Local\Android

Next Step: Add 2 value in path variables :


  • 0
Reply Report