Android Studio中Dart依赖English_words出现Target URI不存在问题求助
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.yamleditor - 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 getagain.
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

