首页 > 解决方案 > Mac m1 颤振项目未在 Android 设备或模拟器上运行

问题描述

我使用的是 Macbook Air M1。简单的颤振项目。尝试通过 Android Studio 或终端颤振为 android 设备或模拟器构建应用程序,返回此消息:

Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
Running Gradle task 'assembleDebug'...
Exception: The flutter tool cannot access the file or directory.
Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user.

为 projet 和 sdk 文件夹尝试 chmod 777 什么也没做。

颤振文档输出:

flutter doctor -v
[✓] Flutter (Channel stable, 2.5.3, on macOS 11.6 20G165 darwin-arm, locale
    en-IL)
    • Flutter version 2.5.3 at /Users/michaelbabozhko/Documents/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 18116933e7 (12 days ago), 2021-10-15 10:46:35 -0700
    • Engine revision d3ea636dc5
    • Dart version 2.14.4

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/michaelbabozhko/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 13.0, Build version 13A233
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] VS Code (version 1.61.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
       https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64  • Android 12
      (API 31) (emulator)
    • Chrome (web)                • chrome        • web-javascript • Google
      Chrome 94.0.4606.81

• No issues found!

标签: androidflutterapple-m1

解决方案


回答!最后我找到了解决方案 - 只是将 android stiudio 设置重置为默认值并下载了插件。请参阅随附的屏幕截图,在此处输入图像描述


推荐阅读