You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android Studio中Dart依赖English_words出现Target URI不存在问题求助

Fixing "Target URI Doesn't exist" Error for english_words Package in Android Studio (Dart/Flutter)

Hey there, I’ve dealt with this exact error a bunch of times when working with Dart/Flutter in Android Studio. Let’s walk through the most reliable fixes step by step:

1. Double-Check Your pubspec.yaml Syntax

YAML is super picky about indentation and spelling—this is the most common culprit. Make sure your pubspec.yaml has the package listed correctly under dependencies, with proper 2-space indentation (no tabs!) and a valid version number:

dependencies:
  flutter:
    sdk: flutter  # Only include this if it's a Flutter project
  english_words: ^4.0.0  # Use the latest version available on pub.dev

2. Manually Run pub get

Sometimes Android Studio’s auto-pub-get doesn’t trigger properly. Try either:

  • Click the Pub get button in the top-right corner of the pubspec.yaml editor
  • Open the terminal at your project root and run:
    # For Flutter projects
    flutter pub get
    
    # For pure Dart projects
    dart pub get
    

3. Verify Spelling and Case

Double-check that you’ve written english_words correctly—no typos like english_word, EnglishWords, or other variations. The package name is all lowercase with an underscore.

4. Clear IDE Cache and Restart

Corrupted IDE cache can cause weird issues like this. Here’s how to fix it:

  • Go to File > Invalidate Caches...
  • Check the box for Invalidate and Restart
  • Let Android Studio restart, then try running pub get again.

5. Check Network Connection & Pub Mirror (if needed)

The english_words package is hosted on pub.dev, so you need a stable internet connection to pull it. If you’re in a region where pub.dev is slow or unreachable, configure a pub mirror (like Aliyun’s) in your terminal:

dart pub config set pub-hosted-url https://mirrors.aliyun.com/dart-pub/

Then run pub get again.

6. Reset pubspec.lock (Last Resort)

If none of the above works, delete the pubspec.lock file in your project root, then run pub get again. This forces Dart to re-resolve all dependencies from scratch.

If you still see the error, check the terminal output after running pub get—it’ll usually give a more specific clue about what’s wrong (like a missing SDK or network issue).

内容的提问来源于stack exchange,提问作者ramsai

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 10:40:43