flutter安卓开发遇到的问题—— 1

Anrola Lv1

最近尝试用Flutter开发安卓应用。
在创建好项目运行时遇到如下问题。

一:

1
cmdline-tools component is missing

解决方法:
在Android studio打开settings >> Languages & Frameworks >> Android SDK >> SDK Tools
找到Android SDK Commend-line Tools勾上并应用。
等待下载完成。

二:

1
2
3
4
Exception in thread "main" javax.net.ssl.SSLHandshakeException: 
(certificate_unknown) PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target

gradle.properties设置代理。

1
2
3
4
5
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=7890
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=7890
systemProp.http.nonProxyHosts=localhost|127.0.0.1|10.*

三:

1
2
3
4
5
6
┌─ Flutter Fix ──────────────────────────────────────────────────────────────────────────────────┐
│ [!] This is likely due to a malformed download of the NDK. │
│ This can be fixed by deleting the local NDK copy at: C:\Programs\Android\ndk\28.2.13676358 │
│ and allowing the Android Gradle Plugin to automatically re-download it. │
│ │
└────────────────────────────────────────────────────────────────────────────────────────────────┘

重新下载NDK,与问题一类似。
手动下载NDK可能会导致下载的版本和项目所用版本不一样,可以直接去NDK目录删掉对应版本。
然后再次运行,会自动下载对应版本NDK。

四:

很多时候会遇到模拟器启动但是完全无法操作,而且运行时会卡在安装apk这一步。

可以在运行时选择冷启动(cold boot),会完全重启模拟器。

五:

在VScode里面写kotlin时,库解析全部失效,全部爆红。
在指令输入重启kotlin服务后,当前页码恢复正常,但是一旦切换页面,又会全部爆红。

解决方法是:把.idea和.dart_tool全删了,然后重新打开项目。
注意安装kotlin插件。

另外
每次修改完都建议在Gradle里clean一下项目。

  • Title: flutter安卓开发遇到的问题—— 1
  • Author: Anrola
  • Created at : 2026-07-31 17:32:36
  • Updated at : 2026-08-01 00:57:56
  • Link: https://redefine.ohevan.com/2026/07/31/flutter-debug-1/
  • License: This work is licensed under CC BY-NC-SA 4.0.
On this page
flutter安卓开发遇到的问题—— 1