URI 的目标不存在于每个 flutter 包甚至项目文件夹中
Target of URI doesn't exist in every flutter package even project folders
今天,当 vs code 打开时,我在稳定频道上将 flutter 升级到 v 1.17.0,并且在我项目的 vs code 上打开了一些选项卡。 flutter 更新完成后,vs code 和 Android Studio 在我项目的 70% 的 .dart 文件中突然显示 "Target of URI doesn't exist:" 错误,即使这些文件位于主目录文件夹中。
error in vs code
error in Android Studio
首先我重启了vs code(或者Android Studio),但是还是出现了同样的错误。之后我尝试了这些命令,但错误仍然存在:
flutter clean
flutter packages upgrade
flutter packages get
这是 flutter doctor -vv 的输出:
[ +24 ms] executing: [D:\SourceFiles\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +61 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[ ] e6b34c2b5c96bb95325269a29a84e83ed8909b5f
[ ] executing: [D:\SourceFiles\flutter/] git tag --contains HEAD
[ +269 ms] Exit code 0 from: git tag --contains HEAD
[ +1 ms] 1.17.0
1.17.0-3.4.pre
[ +10 ms] executing: [D:\SourceFiles\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[ +36 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ ] origin/stable
[ ] executing: [D:\SourceFiles\flutter/] git ls-remote --get-url origin
[ +34 ms] Exit code 0 from: git ls-remote --get-url origin
[ ] https://github.com/flutter/flutter.git
[ +91 ms] executing: [D:\SourceFiles\flutter/] git rev-parse --abbrev-ref HEAD
[ +38 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ +1 ms] stable
[ +51 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ +21 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ +7 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ +13 ms] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +29 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[ ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[ ] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[ +11 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ +6 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[ ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ +13 ms] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +1 ms] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ +2 ms] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[ +35 ms] executing: [D:\SourceFiles\flutter/] git rev-parse --abbrev-ref HEAD
[ +34 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ ] stable
[ ] Skipping request to fetchTags - on well known channel stable.
[ ] executing: [D:\SourceFiles\flutter/] git tag --contains HEAD
[ +308 ms] Exit code 0 from: git tag --contains HEAD
[ +1 ms] 1.17.0
1.17.0-3.4.pre
[ +4 ms] Doctor summary (to see all details, run flutter doctor -v):
[ +18 ms] executing: C:\Program Files\Android\Android Studio\jre\bin\java -version
[ +121 ms] Exit code 0 from: C:\Program Files\Android\Android Studio\jre\bin\java -version
[ ] openjdk version "1.8.0_202-release"
OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
OpenJDK 64-Bit Server VM (build 25.202-b03, mixed mode)
[ +31 ms] executing: C:\Program Files\Android\Android Studio\jre\bin\java -version
[ +89 ms] Exit code 0 from: C:\Program Files\Android\Android Studio\jre\bin\java -version
[ ] openjdk version "1.8.0_202-release"
OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
OpenJDK 64-Bit Server VM (build 25.202-b03, mixed mode)
[ +9 ms] executing: [D:\SourceFiles\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%ar
[ +47 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%ar
[ ] 10 days ago
[ +51 ms] java -version
[ +146 ms] executing: D:\SourceFiles\sdk\platform-tools\adb.exe devices -l
[ +19 ms] [√] Flutter (Channel stable, v1.17.0, on Microsoft Windows [Version 10.0.18362.418], locale en-US)
\[ +73 ms] List of devices attached
[ +8 ms] executing: D:\SourceFiles\sdk\platform-tools\adb.exe devices -l
|[ +62 ms] List of devices attached
[ +155 ms] executing: D:\SourceFiles\sdk\tools\bin\sdkmanager --licenses
[+1872 ms] [!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[ +1 ms] X Android license status unknown.
[ +1 ms] Try re-installing or updating your Android SDK Manager.
[ ] See https://developer.android.com/studio/#downloads or visit visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions.
[ +24 ms] [√] Android Studio (version 3.5)
[ +5 ms] [√] VS Code, 32-bit edition
[ +4 ms] [√] VS Code, 64-bit edition (version 1.44.2)
[ +12 ms] [!] Connected device
[ ] ! No devices available
[ ] ! Doctor found issues in 2 categories.
[ +9 ms] "flutter doctor" took 3,376ms.
有什么想法吗?
经过数小时的搜索和重新安装 IDE、flutter 等。我终于发现当 uri 中有 space(如文件夹名称中的 space)时,dart 分析器找不到它.为了解决这个问题,我更改了所有文件夹并从文件夹名称中删除 space 。我认为这在某种程度上是个问题。
今天,当 vs code 打开时,我在稳定频道上将 flutter 升级到 v 1.17.0,并且在我项目的 vs code 上打开了一些选项卡。 flutter 更新完成后,vs code 和 Android Studio 在我项目的 70% 的 .dart 文件中突然显示 "Target of URI doesn't exist:" 错误,即使这些文件位于主目录文件夹中。
error in vs code
error in Android Studio
首先我重启了vs code(或者Android Studio),但是还是出现了同样的错误。之后我尝试了这些命令,但错误仍然存在:
flutter clean
flutter packages upgrade
flutter packages get
这是 flutter doctor -vv 的输出:
[ +24 ms] executing: [D:\SourceFiles\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +61 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[ ] e6b34c2b5c96bb95325269a29a84e83ed8909b5f
[ ] executing: [D:\SourceFiles\flutter/] git tag --contains HEAD
[ +269 ms] Exit code 0 from: git tag --contains HEAD
[ +1 ms] 1.17.0
1.17.0-3.4.pre
[ +10 ms] executing: [D:\SourceFiles\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[ +36 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ ] origin/stable
[ ] executing: [D:\SourceFiles\flutter/] git ls-remote --get-url origin
[ +34 ms] Exit code 0 from: git ls-remote --get-url origin
[ ] https://github.com/flutter/flutter.git
[ +91 ms] executing: [D:\SourceFiles\flutter/] git rev-parse --abbrev-ref HEAD
[ +38 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ +1 ms] stable
[ +51 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ +21 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ +7 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ +13 ms] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +29 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[ ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[ ] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[ +11 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ +6 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[ ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ +13 ms] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +1 ms] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ +2 ms] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[ +35 ms] executing: [D:\SourceFiles\flutter/] git rev-parse --abbrev-ref HEAD
[ +34 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ ] stable
[ ] Skipping request to fetchTags - on well known channel stable.
[ ] executing: [D:\SourceFiles\flutter/] git tag --contains HEAD
[ +308 ms] Exit code 0 from: git tag --contains HEAD
[ +1 ms] 1.17.0
1.17.0-3.4.pre
[ +4 ms] Doctor summary (to see all details, run flutter doctor -v):
[ +18 ms] executing: C:\Program Files\Android\Android Studio\jre\bin\java -version
[ +121 ms] Exit code 0 from: C:\Program Files\Android\Android Studio\jre\bin\java -version
[ ] openjdk version "1.8.0_202-release"
OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
OpenJDK 64-Bit Server VM (build 25.202-b03, mixed mode)
[ +31 ms] executing: C:\Program Files\Android\Android Studio\jre\bin\java -version
[ +89 ms] Exit code 0 from: C:\Program Files\Android\Android Studio\jre\bin\java -version
[ ] openjdk version "1.8.0_202-release"
OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
OpenJDK 64-Bit Server VM (build 25.202-b03, mixed mode)
[ +9 ms] executing: [D:\SourceFiles\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%ar
[ +47 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%ar
[ ] 10 days ago
[ +51 ms] java -version
[ +146 ms] executing: D:\SourceFiles\sdk\platform-tools\adb.exe devices -l
[ +19 ms] [√] Flutter (Channel stable, v1.17.0, on Microsoft Windows [Version 10.0.18362.418], locale en-US)
\[ +73 ms] List of devices attached
[ +8 ms] executing: D:\SourceFiles\sdk\platform-tools\adb.exe devices -l
|[ +62 ms] List of devices attached
[ +155 ms] executing: D:\SourceFiles\sdk\tools\bin\sdkmanager --licenses
[+1872 ms] [!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[ +1 ms] X Android license status unknown.
[ +1 ms] Try re-installing or updating your Android SDK Manager.
[ ] See https://developer.android.com/studio/#downloads or visit visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions.
[ +24 ms] [√] Android Studio (version 3.5)
[ +5 ms] [√] VS Code, 32-bit edition
[ +4 ms] [√] VS Code, 64-bit edition (version 1.44.2)
[ +12 ms] [!] Connected device
[ ] ! No devices available
[ ] ! Doctor found issues in 2 categories.
[ +9 ms] "flutter doctor" took 3,376ms.
有什么想法吗?
经过数小时的搜索和重新安装 IDE、flutter 等。我终于发现当 uri 中有 space(如文件夹名称中的 space)时,dart 分析器找不到它.为了解决这个问题,我更改了所有文件夹并从文件夹名称中删除 space 。我认为这在某种程度上是个问题。