Flutter项目在Android Studio运行时出现FirebaseAppPlatform.verifyExtends成员未找到错误求助
Hey, I’ve run into this exact issue before — let’s break down what’s happening and fix it properly, no messy edits to system cache files required (trust me, you don’t want to go that route).
What’s Causing the Error
Even though you declared firebase_core: ^1.7.0 in your pubspec.yaml, your project is actually pulling and using firebase_core-1.24.0 under the hood. That newer version removed the FirebaseAppPlatform.verifyExtends method, but some code (either yours or a dependency you’re using) is still trying to call it — hence the "member not found" error.
Critical Note: Never edit files directly in the .pub-cache folder! Any changes you make there will get overwritten the next time you run flutter pub get or flutter pub upgrade, and it’ll create inconsistencies if you’re collaborating with a team.
Step-by-Step Solutions
1. Lock Firebase Core to Your Desired Version
First, fix the version in your pubspec.yaml to a hard, non-upgradable version by removing the caret (^):
dependencies: firebase_core: 1.7.0 # No more ^ here — forces exact version
Then run this command to refresh your dependencies:
flutter pub get
This tells Pub to use exactly 1.7.0 instead of automatically pulling a newer, incompatible version.
2. Resolve Dependency Conflicts (If They Pop Up)
If locking the version causes errors with other Firebase packages (like needing a newer firebase_core), you’ll need to track down which dependency is forcing the upgrade. Run this command to view your full dependency tree:
flutter pub deps
Look for any packages that list a higher firebase_core version as a requirement. You have two options here:
- Downgrade those conflicting packages to versions that work with
firebase_core: 1.7.0, or - If you need the newer features from those packages, upgrade your code to match a newer
firebase_coreversion. You’ll need to replace calls toFirebaseAppPlatform.verifyExtendswith the updated API (check Firebase Core’s changelog — the replacement is usuallyFirebaseAppPlatform.instanceFor).
3. Clear Stale Cache and Reinstall Dependencies
If the above steps don’t resolve the issue, wipe the pub cache to eliminate any lingering stale versions:
flutter pub cache clean flutter pub get
Quick Pro Tip
Always keep all your Firebase-related dependencies on matching versions. Mixing old and new Firebase packages is one of the most common causes of these compatibility headaches.
内容的提问来源于stack exchange,提问作者himani patel

