FIREBASE FOR FLUTTER CodeLab not working on IOS sim - firebase

I'm pretty new to Flutter and want to add Firebase to my Flutter app. So I went through the Flutter Codelab:
enter link description here
However I am getting errors as soon as I add the Cloud_Firestore package to my Pubspec.yaml file:
dependencies:
flutter:
sdk: flutter
cloud_firestore: ^0.8.2 # new
I continued hoping that a following activity would resolve the problem and created the GoogleService-Info.plist file and added that as instructed.
However I still get the errors and build fail.
Here are the errors:
Error output from Xcode build: ↳ 2019-01-21 10:19:17.576
xcodebuild[70286:12860097] [MT] PluginLoading: Required plug-in
compatibility UUID D7881182-AD00-4C36-A94D-F45FC9B0CF85 for plug-in at
path '~/Library/Application
Support/Developer/Shared/Xcode/Plug-ins/RealmPlugin.xcplugin' not
present in DVTPlugInCompatibilityUUIDs 2019-01-21 10:19:17.577
xcodebuild[70286:12860097] [MT] PluginLoading: Required plug-in
compatibility UUID D7881182-AD00-4C36-A94D-F45FC9B0CF85 for plug-in at
path '~/Library/Application
Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin' not present
in DVTPlugInCompatibilityUUIDs
** BUILD FAILED **
Any help with solving this would be really appreciated
Thanks

Ok so I found the answer. Not sure why it's happening, seems that it's due to a bug in cloud_firestore 0.8.0.
So if anyone else is having this error, do the following:
go to terminal, open your apps directory,
cd ios
pod update Firebase
That should fix it.

Related

How to know which version of Google Firebase plugin to use in Flutter app?

I've been stuck with Gradle not building (working on iOS fine). I struggled because Gradle was giving a generic error, finally got this today:
FAILURE: Build failed with an exception.
* What went wrong: Failed to capture fingerprint of input files for task ':app:preDebugBuild' property 'compileManifests' during up-to-date check.
> In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[18.0. 0]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
Dependency failing: com.google.firebase:firebase-messaging:18.0.0 -> com.google.firebase:firebase-iid#[18.0.0], but fire base-iid version was 17.1.2.
The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art ifact with the issue. -- Project 'app' depends on project 'firebase_messaging' which depends onto com.google.firebase:firebase-messaging#18.0. 0
-- Project 'app' depends on project 'firebase_core' which depends onto com.google.firebase:firebase-core#16.0.9 -- Project 'app' depends on project 'firebase_analytics' which depends onto com.google.firebase:firebase-analytics#16.5. 0 -- Project 'app' depends on project 'firebase_remote_config' which depends onto com.google.firebase:firebase-config#16.4 .1 -- Project 'app' depends onto com.google.firebase:firebase-core#16.0.9
For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https:// github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your b uild.gradle file.
* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
This was after I took out the version numbers from my pubspec to see if that would help. I don't understand Google's version numbering and I'm not sure which versions of plugins I should be installing as it has caused conflicts in the past:
dependencies:
flutter:
sdk: flutter
http:
cached_network_image:
flutter_cache_manager:
carousel_pro:
cloud_firestore:
firebase_core:
firebase_remote_config:
dynamic_theme:
flutter_signin_button:
shared_preferences:
share:
flutter_search_bar:
google_sign_in:
#flutter_facebook_login:
flutter_html:
requests:
webview_flutter:
flutter_webview_plugin:
firebase_analytics:
flutter_app_badger: #for launcher badge icon (notifications)
uuid:
font_awesome_flutter:
device_info:
carousel_slider:
flutter_spinkit:
flutter_typeahead:
firebase_messaging:
html_unescape:
flutter_masked_text:
configurable_expansion_tile:
stripe_payment:
square_in_app_payments:
Google doesn't seem to maintain consistent version numbering and by taking out the version numbers I thought it would at least take the latest version of the plugins which theoretically should work. So, how can I solve this?
You should begin by putting the version number back in there.
This is an issue with firebase / play services versions being mismatched so you know for sure the other plugins in your pubspec.yaml are fine.
The dependancy which is failing is firebase messaging.
It's using many words to tell you
com.google.firebase:firebase-messaging:18.0.0 package depends on com.google.firebase:firebase-iid#[18.0.0]
but it's only finding 17.1.2.
You need
com.google.firebase:firebase-core#16.0.9
com.google.firebase:firebase-analytics#16.5.0
com.google.firebase:firebase-config#16.4.1
in the future, if you are having version issues check the specific packages GitHub issues to see if there's anything currently wrong with the version you're on. This will save you a lot of time.
I wouldn't recommend removing version numbers from your pubsepc.yaml but if you type
firebase_messaging: any
It will get a compatible version for you.
The error you are getting is not necessarily from the packages you have listed in pubspec.yaml. It is referring to the dependencies on build.gradle.
Google has no issue with the version numbers. There is a difference between the versions of packages i.e what you have listed on pubspec.yaml and the dependencies on app/build.gradle. It would be wise to reconsider the number of packages you use as every package has a dependency and you may end up in a sticky situation where multiple packages are conflicting. In addition you end up with a bloated solution for minimal functionality.
Removing version numbers will not help as some packages are incompatible. I would suggest you start with the packages you require i.e the firebase which from experience have no issues then incrementally add if necessary.

firebase_analytics 0.0.4 which requires SDK version >=1.8.0 <2.0.0, version solving failed

I am trying to learn mobile devt using flutter, dat and firebase. SO as a start I downloaded the chat app code from here
But I can't seem to run the code via vscode and android studio. Can anyone please help me figure out how to run this.
error is:
VScode:
{
"resource": "/C:/Users/Administrator/Downloads/flutter-chat-app-master/flutter-chat-app-master/lib/ChatMessageListItem.dart",
"owner": "dart",
"code": "uri_does_not_exist",
"severity": 8,
"message": "Target of URI doesn't exist: 'package:firebase_database/firebase_database.dart'.\nTry creating the file referenced by the URI, or Try using a URI for a file that does exist.",
"source": "dart",
"startLineNumber": 1,
"startColumn": 8,
"endLineNumber": 1,
"endColumn": 58,
"tags": []
}
this is the error when i run it in android studio.
C:\src\flutter\bin\flutter.bat --no-color packages get Running
"flutter packages get" in flutter-chat-app-master... The current
Dart SDK version is 2.3.0-dev.0.5.flutter-a1668566e5.
Because flutter_chat_app depends on firebase_analytics 0.0.4 which
requires SDK version >=1.8.0 <2.0.0, version solving failed. pub get
failed (1)
I was able to run other sample codes, one is from this so I know that my setup is working.
I already tried few possbile solutions but not working, I saw this , but did not solve my issue.
I think the error requires me to downgrade android sdk but I dont know where to do that. I just need to run so I can see what it looks and I can follow. thanks.
You are using SDK version 2.3 and the package firebase_analytics 0.0.4 requires SDK version >=1.8.0 <2.0.0.
Some dependencies of this project are out of the date.
cupertino_icons: ^0.1.2
firebase_auth: 0.7.0
google_sign_in: 3.2.4
cloud_firestore: 0.8.2+3
fluttertoast: ^2.0.7
image_picker: 0.4.12+1
shared_preferences: 0.4.3
firebase_storage: 1.0.4
cached_network_image: ^0.7.0
intl: ^0.15.7
Update all of them to the newest version.
After a lot of googling , reinstalling, downgrade, upgrade, package get(which never worked coz the error was in the way so it exits before it could 'get'), package upgrade etc, I was finally able to solve this.
The only problem I had was I did not know which version (or what is the latest) to use coz for some reason, it wasn't indicated in their list of "versions", or least it wasn't easy to find coz I always end up in this page. Simply putting these lines (and/or doing the answer above)
environment:
sdk: '>=2.1.0 <3.0.0'
dependencies:
flutter:
sdk: flutter
google_sign_in: ^0.3.1
firebase_analytics: ^0.0.4
firebase_auth: ^0.2.0
firebase_database: ^0.0.12
firebase_storage: ^0.0.5
in yaml did not solve it, although a lot of ppl claimed it did.
the only thing that solved it was when I happen to go in this page where it contains the correct and latest firebase versions that the latest Dart SDK where in my case - DART SDK 2.3 supports.
just get the current version to this You can search every plugin in the search bar.
my yaml looks like this now:
dependencies:
flutter:
sdk: flutter
image_picker: ^0.6.0+8
google_sign_in: ^4.0.1+3
firebase_analytics: ^3.0.1
firebase_auth: ^0.11.1+1
firebase_database: ^3.0.0
firebase_storage: ^3.0.0
Added steps which I am not sure if it is necessary, but I did it before the version correcting.
invalidate cache, restart
In relation with running the app itself, and not particular to firebase:
change gradle version by doing steps from here (because of some error with gradle not related to firebase) and look for answer of keviepanas
Fixed: i got thesame issue as when trying to run flutter upgrade, have tried all the fix online nothing seems to be working, all i deed was upgrade manually and boom, everything worked like magic
1.Download the latest stable version from https://flutter.dev/docs/get-started/install/windows
2.then copy the extracted folder to your flutter directory,
3 delete all files from your previous flutter directory, and paste in the current files
from the latest release
Note: do not delete the flutter sdk directory folder, of cause you cant cause it is already in use.
Summary: all you need do is download the latest version and replace the content(files)with your old flutter sdk files and you are good to go
This combination is working
environment:
sdk: ">=2.1.0<3.0.0"
dependencies:
firebase_core: ^0.3.4
firebase_auth: ^0.8.4+5
cloud_firestore: ^0.9.13+1
flutter:
sdk: flutter
Just try one of the previous versions. The latest one which is dev version is not worked for me. Using an old version worked for me.

Flutter Firebase (firebase_core) does not build on Android

When using the Firebase plugins and starting an Android build, I get the following error:
ERROR: Failed to resolve: com.google.firebase:firebase-core:
Affected Modules: app, firebase_core.
It works fine on iOS.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
> Could not find com.google.firebase:firebase-core:.
Required by:
project :app
project :app > project :firebase_core
This issue was fixed in the 0.3.4 update of firebase_core, which is a dependency of other Flutter Firebase plugins. You should be able to get the fix with a "flutter packages upgrade".
https://github.com/flutter/plugins/pull/1464/files
This is an issue that occurs because FlutterFire is migrating to BoM.
To solve this issue for now, you should just use firebase_core: 0.3.1+1.
The ideal solution would be adding the following to your settings.gradle in your android module:
enableFeaturePreview('IMPROVED_POM_SUPPORT')
However, this might not work. In that case, you should revert to 0.3.1+1 for the moment.
You can find out more about it here.

What happened with HTTP package in Dart 2.1?

With dart 2.0 and lower I was able to import the HTTP package directly without modifying my pubspec.yaml file.
I've opened an old project and I've got the error:
"Your application could not be compiled, because its dependencies could not be established.
That library is in a package that is not known. Maybe you forgot to mention it in your pubspec.yaml file?"
I had to go to pubpect.yaml file, and under dependencies I've added: "http: ^0.12.0" to make my project work again.
What happened, why was the HTTP package removed from dart core libraries?
https://github.com/flutter/flutter/wiki/Changelog#v025
v0.2.5
#15416 removed package:http from Flutter and replaced all usages with the HttpClient from dart:io. If you use package:http you must add it
as a dependency in your pubspec.yaml to continue using it.
See https://github.com/flutter/flutter/wiki/Changelog#v025
As the flutter has removed the http from dart.io, you can't directly use it without specifying the dependency in pubspec.yaml file.
open the flutter project and add the http library dependency as given below,
dependencies:
flutter:
sdk: flutter
shared_preferences: "^0.4.2"
http: ^0.12.0

The Target URI doesn't Exist:'package:firebase_database/firebase_database.dart';

Importing Dependencies in Pubsec.Yaml is successfull,
But when opening main.dart file it shows the error
Problem(1)
The Target URI doesn't Exist:
'package:firebase_database/firebase_database.dart';
Either
flutter packages get
needs to be run or failed when you run it
or you just need to restart your IDE. I saw it mentioned a few times recently that this was necessary to fix the problem.
1- Go to the link: https://pub.dev/packages/firebase_database#-installing-tab-
2- Add dependencies in pubspec.yaml file.e.g:-
dependencies:
flutter:
sdk: flutter
firebase_database: ^3.1.3
3- Press ctrl+s after two seconds it will give a message click on Get Dependencies, and wait for some time its will run pub get in your project.
4- Problem will be solved.

Resources