I'm actually coding an app using Flutter. I use Firebase as backend.
My app is using Firebase Auth, Firebase Firestore and Firebase Storage and everything was working well.
I'm coding using a Windows computer so I can't use the flutter build ios
command.
As I wanted my app to be usable for iOS users, I tried to build my app with flutter build web
and host this web version using the Firebase Hosting service.
I did the command :
flutter build web
then :
firebase init hosting
and then :
firebase deploy --only hosting
Here is the error I had during the last command :
Error: HTTP Error: 404, Requested entity was not found.
I did some other Flutter X Firebase project and the Firebase Hosting service was working well.
So, here are my 2 questions :
I'm not from an english speaking country at all, I hope I was understandable for anyone !
By the way, I tried many times to rebuild my app and I also tried these commands :
flutter clean
and
flutter pub get
Nothing worked.
My "main.dart" file is initializing well my Firebase backend as you can see below :
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
runApp(const MyApp());
}
Thanks for your help in advance, if you have any idea or solution (even if you're not sure about it) don't be shy to comment or answer this post (everything is a great help to me) !
I have some good news! I finally figured out what was causing the issue with Firebase Hosting in my Flutter project. It turned out that my project was linked to the wrong Firebase project, but only for the Firebase Hosting service.
To fix the issue, I simply linked the correct Firebase project back to my Flutter project and ran the following commands:
flutter build web
firebase init hosting
firebase deploy --only hosting
After running these commands, everything worked perfectly fine!