简体   繁体   中英

Not able to run Flutter Project in Android Emulator or Android Physical Device

I am using Android Studio in Mac. When I try to run my newly created sample flutter project in Android Emulator, I am getting below Error.

Checking the license for package SDK Patch Applier v4 in /usr/local/Caskroom/android-platform-tools/29.0.5/licenses

Warning: License for package SDK Patch Applier v4 not accepted.

Checking the license for package Android Emulator in /usr/local/Caskroom/android-platform-tools/29.0.5/licenses

Warning: License for package Android Emulator not accepted.

Checking the license for package Android SDK Tools in /usr/local/Caskroom/android-platform-tools/29.0.5/licenses

Warning: License for package Android SDK Tools not accepted.

Checking the license for package Android SDK Build-Tools 28.0.3 in /usr/local/Caskroom/android-platform-tools/29.0.5/licenses

Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.

Checking the license for package Android SDK Platform 28 in /usr/local/Caskroom/android-platform-tools/29.0.5/licenses

Warning: License for package Android SDK Platform 28 not accepted.

FAILURE: Build failed with an exception.

  • What went wrong: Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.

    Failed to install the following Android SDK packages as some licences have not been accepted. patcher;v4 SDK Patch Applier v4 build-tools;28.0.3 Android SDK Build-Tools 28.0.3 emulator Android Emulator tools Android SDK Tools platforms;android-28 Android SDK Platform 28 To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager. Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

    Using Android SDK: /usr/local/Caskroom/android-platform-tools/29.0.5

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

When I open android module from flutter project like this Image(Open Android Module in Android Studio),

在此处输入图像描述

Then New Android Studio window opened with Android Module of this sample project. I am able to run this android module project into emulator without any problem. I wonder why android studio is giving this error when I directly run from flutter project of same android module.

Note: All license for all android SDK packages are accepted

Android SDK path of my flutter was not defined.. Once I change my flutter android sdk path using below command

flutter config --android-sdk 'My SDK Path'

Everything works well.. Now I am able to run in android emulator.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM