简体   繁体   English

无法在 Android 模拟器或 Android 物理设备中运行 Flutter 项目

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

I am using Android Studio in Mac.我在 Mac 中使用 Android Studio。 When I try to run my newly created sample flutter project in Android Emulator, I am getting below Error.当我尝试在 Android 模拟器中运行我新创建的示例 flutter 项目时,出现以下错误。

Checking the license for package SDK Patch Applier v4 in /usr/local/Caskroom/android-platform-tools/29.0.5/licenses在 /usr/local/Caskroom/android-platform-tools/29.0.5/licenses 中检查 package SDK Patch Applier v4 的许可证

Warning: License for package SDK Patch Applier v4 not accepted.警告:不接受 package SDK Patch Applier v4 的许可证。

Checking the license for package Android Emulator in /usr/local/Caskroom/android-platform-tools/29.0.5/licenses在 /usr/local/Caskroom/android-platform-tools/29.0.5/licenses 中检查 package Android 模拟器的许可证

Warning: License for package Android Emulator not accepted.警告:不接受 package Android 模拟器的许可证。

Checking the license for package Android SDK Tools in /usr/local/Caskroom/android-platform-tools/29.0.5/licenses检查许可证 package Android SDK /usr/local/Caskroom/android-platform-tools/29.0.5/licenses 中的工具

Warning: License for package Android SDK Tools not accepted.警告:不接受 package Android SDK 工具的许可证。

Checking the license for package Android SDK Build-Tools 28.0.3 in /usr/local/Caskroom/android-platform-tools/29.0.5/licenses在 /usr/local/Caskroom/android-platform-tools/29.0.5/licenses 中检查 package Android SDK Build-Tools 28.0.3 的许可证

Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.警告:不接受 package Android SDK Build-Tools 28.0.3 的许可证。

Checking the license for package Android SDK Platform 28 in /usr/local/Caskroom/android-platform-tools/29.0.5/licenses在 /usr/local/Caskroom/android-platform-tools/29.0.5/licenses 中检查 package Android SDK Platform 28 的许可证

Warning: License for package Android SDK Platform 28 not accepted.警告:不接受 package Android SDK 平台 28 的许可证。

FAILURE: Build failed with an exception.失败:构建失败,出现异常。

  • What went wrong: Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.出了什么问题:无法确定任务 ':app:compileDebugJavaWithJavac' 的依赖项。

    Failed to install the following Android SDK packages as some licences have not been accepted.无法安装以下 Android SDK 软件包,因为某些许可证尚未被接受。 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. 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缺少的组件使用 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或者,要将许可协议从一个工作站转移到另一个工作站,请参阅http://d.android.com/r/studio-ui/export-licenses.html

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

  • Try: Run with --stacktrace option to get the stack trace.尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。 Run with --info or --debug option to get more log output. Run with --scan to get full insights.使用 --info 或 --debug 选项运行以获取更多日志 output。使用 --scan 运行以获取完整的见解。

When I open android module from flutter project like this Image(Open Android Module in Android Studio),当我像这样打开 flutter 项目中的 android 模块时(在 Android Studio 中打开 Android 模块),

在此处输入图像描述

Then New Android Studio window opened with Android Module of this sample project.然后 New Android Studio window 打开这个示例项目的 Android 模块。 I am able to run this android module project into emulator without any problem.我能够毫无问题地将这个 android 模块项目运行到模拟器中。 I wonder why android studio is giving this error when I directly run from flutter project of same android module.我想知道当我直接从同一个 android 模块的 flutter 项目运行时,为什么 android studio 会给出这个错误。

Note: All license for all android SDK packages are accepted注意:接受所有 android SDK 包的所有许可证

Android SDK path of my flutter was not defined.. Once I change my flutter android sdk path using below command Android SDK 我的 flutter 路径未定义。一旦我使用以下命令更改我的 flutter android sdk 路径

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

Everything works well.. Now I am able to run in android emulator.一切正常.. 现在我可以在 android 模拟器中运行了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我无法在 android(模拟器和真实设备)上运行我的 flutter 项目。 我该如何解决? - I'm not able to run my flutter project on android (emulator & real device). How can I fix it? 仅在物理设备而非模拟器上运行 Android 应用 - Run Android app Only on Physical Device not Emulator 无法使用 Flutter 中的 VideoController 在 iOS 物理设备上下载和播放由 Android 模拟器上传的视频文件 - Not able to download and play video files that are uploaded by an Android Emulator on an iOS physical device using VideoController in Flutter Flutter - 无法在 android 设备中运行 - Flutter - not able to run in android device Flutter 应用程序在 Android 模拟器上运行,但不在物理设备上(OnePlus 7T) - Flutter app is running on Android Emulator but not on Physical Device (OnePlus 7T) 如何在 Android Studio 中将我的物理设备作为模拟器运行? - How can I run my physical device as an emulator in Android studio? 在没有设备或模拟器的情况下创建并运行android项目 - Create and run an android project without a device or emulator 无法在设备和模拟器上运行Android Project - Unable to run Android Project On Device and Emulator 将 android 仿真器连接为物理 android 设备 - connecting android emulator as a physical android device 无法运行Android模拟器 - Not able to run the Android Emulator
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM