Flutter全新安装无法在android上运行

发布于 2025-01-09 05:34:41 字数 2853 浏览 2 评论 0原文

免责声明

我在安装 android studio 时遇到了这个问题,在遇到这个问题之前我已经使用 android studio 一段时间了。我正在尝试卸载 android studio 以节省一些存储空间并手动安装 android 模拟器,但仍然面临同样的问题。

描述

当尝试在 Android 模拟器中运行时,我的 flutter 应用程序扫描错误目录中的密钥库,我的应用程序密钥库位于 /Users/saidulumam/Documents/Projects/flutter/tome/android/~/Library/Android/Sdk/.android/debug.keystore 但它扫描 /Users/saidulumam/Documents/Projects/flutter/tome/android/app/~/Library/Android/Sdk/.android/debug.keystore

重现步骤

  1. 转到项目文件夹
  2. 类型 flutter在本例中创建 app_name,我使用名称 tome
  3. 类型 cd tome
  4. 类型 flutter run
  5. 错误

屏幕截图

在此处输入图像描述

我的目录 输入图片此处描述

日志

错误结果:

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':app:packageDebug' (type 'PackageApplication').
> File '/Users/saidulumam/Documents/Projects/flutter/tome/android/app/~/Library/Android/Sdk/.android/debug.keystore' specified for property 'signingConfig.signingConfigData.storeFile' does not exist.

* 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.

* Get more help at https://help.gradle.org

BUILD FAILED in 32s
Running Gradle task 'assembleDebug'...                             33.9s
Exception: Gradle task assembleDebug failed with exit code 1

flutter doctor:

➜  tome flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.0, on macOS 12.2.1 21D62 darwin-arm, locale en-ID)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[!] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[!] Android Studio (not installed)
[✓] VS Code (version 1.64.2)
[✓] Connected device (1 available)
[✓] HTTP Host Availability

! Doctor found issues in 3 categories.

Disclaimer

i got this issue when i had android studio installed, i've been using android studio for a while before i got this issue. and i'm trying to uninstalling android studio to save some of my storage and manually install android emulator, still facing the same issue.

Description

my flutter app scan keystore in the wrong directory when try to run in android emulator, my app keystore located at
/Users/saidulumam/Documents/Projects/flutter/tome/android/~/Library/Android/Sdk/.android/debug.keystore
but it scans
/Users/saidulumam/Documents/Projects/flutter/tome/android/app/~/Library/Android/Sdk/.android/debug.keystore

Steps to Reproduce

  1. go to project folder
  2. type flutter create app_name in this case im using name tome
  3. type cd tome
  4. type flutter run
  5. error

Screenshot

enter image description here

my directory
enter image description here

Logs

Error result :

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':app:packageDebug' (type 'PackageApplication').
> File '/Users/saidulumam/Documents/Projects/flutter/tome/android/app/~/Library/Android/Sdk/.android/debug.keystore' specified for property 'signingConfig.signingConfigData.storeFile' does not exist.

* 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.

* Get more help at https://help.gradle.org

BUILD FAILED in 32s
Running Gradle task 'assembleDebug'...                             33.9s
Exception: Gradle task assembleDebug failed with exit code 1

flutter doctor :

➜  tome flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.0, on macOS 12.2.1 21D62 darwin-arm, locale en-ID)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[!] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[!] Android Studio (not installed)
[✓] VS Code (version 1.64.2)
[✓] Connected device (1 available)
[✓] HTTP Host Availability

! Doctor found issues in 3 categories.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

中性美 2025-01-16 05:34:41

尝试使用此命令指定 flutter 的 android sdk 路径:

flutter config --android-sdk <path-to-your-android-sdk-path>

try this command for specifying android sdk path to flutter :

flutter config --android-sdk <path-to-your-android-sdk-path>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文