[英]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.