Skip to content

Problems running app on physical device (first time) from Android Studio #13985

@Sfshaza

Description

@Sfshaza

Problem:

I'm using Android Studio and, for the first time, have connected a physical device—I generally use the Simulator. I'm trying to run the most basic sample app on the phone, and I'm getting this error from Studio:

* Error running Gradle:
Unable to download needed Android SDK components, as the following licenses have not 
been accepted:
Android SDK Build-Tools 26.0.3, Android SDK Platform 26

To resolve this, please run the following command in a Terminal:
flutter doctor --android-licenses

However, when I run the command (flutter doctor --android-licenses), I'm getting:

Error: Unknown argument --licenses

Solution:

  • First, I didn't have the Android SDK in my path—I don't recollect seeing this in the setup page. I needed to add the following:
~/Library/Android/sdk/tools/bin
  • Then, I had to update the SDK Manager:
sdkmanager --update
  • Finally, I had to run the command:
flutter doctor --android-licenses

Output from flutter doctor:

GoogleDrive $ flutter doctor
[✓] Flutter (on Mac OS X 10.12.6 16G1114, locale en-US, channel master)
    • Flutter at /Users/shaza/GoogleDrive/TMP-flutter/flutter
    • Framework revision 4954bbfaf9 (3 hours ago), 2018-01-08 13:48:08 -0800
    • Engine revision 6a724f0d3e
    • Tools Dart version 1.25.0-dev.11.0
    • Engine Dart version 2.0.0-edge.5b56dfb77a76e9d8021086c0684b1e8bd9dbca9a

[✓] Android toolchain - develop for Android devices (Android SDK 26.0.3)
    • Android SDK at /Users/shaza/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-26, build-tools 26.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_152-release-915-b08)

[✓] iOS toolchain - develop for iOS devices (Xcode 9.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.1, Build version 9B55
    • ios-deploy 1.9.2
    • CocoaPods version 1.3.1

[✓] Android Studio (version 3.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)

[✓] IntelliJ IDEA Ultimate Edition (version 2017.2.5)
    • Flutter plugin version 17.0
    • Dart plugin version 172.3968.27

[✓] Connected devices
    • Moto G 4 • ZY223GJDRL • android-arm • Android 6.0.1 (API 23)

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: first hourThe first hour of using Flutter

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions