I am trying to add Firebase to my flutter app. But when I add firebase_core dependency in the pubspec_yaml and run Packages get, it gives an error.
19-----dependencies:
20-----flutter:
21-----sdk: flutter
22-----firebase_core: ^0.2.5
This is the code that gives the error.
The output of Packages get :
C:\flutter\bin\flutter.bat --no-color packages get
Running "flutter packages get" in trial_one...
Error on line 21, column 5 of pubspec.yaml: A dependency may only have one source.
sdk: flutter
^^^^^^^^^^^^^^
pub get failed (65)
Process finished with exit code 65
I followed the exact instructions on the Add Firebase to Flutter site. But still I get this error.
The indentation is actually not good, here's the correct one :
dependencies:
flutter:
sdk: flutter
firebase_core: ^0.3.1+1
Hope it's help !!
Related
I attached what I got in debug console when I try to run my app.
These are my firebase dependencies
firebase_core: ^1.12.0
firebase_auth: ^3.3.8
cloud_firestore: ^3.1.9
Launching lib\main.dart on ***** in debug mode...
/C:/src/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_platform_interface-6.2.0/lib/src/method_channel/utils/exception.dart:14:11: Error: Method not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace(exception, stackTrace);
^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_platform_interface-6.2.0/lib/src/method_channel/utils/exception.dart:17:9: Error: Method not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace(
^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_platform_interface-6.2.0/lib/src/method_channel/utils/exception.dart:12:7: Error: A non-null value must be returned since the return type 'Never' doesn't allow null.
Never convertPlatformException(Object exception, StackTrace stackTrace) {
^
FAILURE: Build failed with an exception.
* Where:
Script 'C:\src\flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\flutter\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* 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
BUILD FAILED in 21s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
I have tried many methods, But they didn't work.
try flutter clean and then flutter run it work for me
flutter version 2.10.4
My first guess is that you might not finish platform-specific installation/setup for Firebase as well as Firebase plugins.
Just to verify that You can visit the FlutterFire website which will guide you through the installation steps for the targeting platforms for Firebase and plugin setup;
Otherwise, the flutter clean and flutter pub get should do the trick.
However, a problem still exists, you can restart your editor and just run the command flutter pub get/ flutter pub upgrade.
I am getting an error message when I run my app with the cloud_firestore: 0.13.7 plugin. But it still builds the app. How do I get rid of this error?
This is a warning, in your build.gradle file change the minSdkVersion to version 21 and run the app again.
Got this error after adding firebase_analytics in pubsec.yaml file.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':firebase_core:compileDebugAidl'.
> The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[16.5.0,16.5.0]], but resolves to 16.0.3. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
* 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
BUILD FAILED in 5s
Finished with error: Gradle task assembleDebug failed with exit code 1
these are dependencies in pubsec.yaml
dependencies:
firebase_analytics:
cloud_firestore:
graphql_flutter: ^1.0.0
firebase_auth:
firebase_core:
mobx: ^0.1.2
flutter_mobx: ^0.1.1
mobx_codegen: ^0.1.0+1
carousel_pro: ^0.0.13
cupertino_icons: ^0.1.2
flutter:
sdk: flutter
thanks
I'm unable to replicate the behavior you've reported at present. Per checking the comments, it looks like that the issue has been solved. Running flutter clean should also solve most conflicts caused in the dependencies cache.
I'm trying to update the package in order to solve this problem. When I change the firebase_auth version on my pubspec.yaml I obtain this:
error
Configure project :firebase_auth
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':firebase_auth'.
> Could not open cp_proj remapped class cache for 1hd54il9uhc3eutyaybhw2pq0
(~/.gradle/caches/4.10.2/scripts-remapped/build_7iuv4c9gs2g2ad3uvhc3eae18/1hd54il9uhc3eutyaybhw2pq0/cp_proj70b1361a260e0ceb212a59c45f680ebd).
> Unexpected lock protocol found in lock file. Expected 3, found 0.
* 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
BUILD FAILED in 0s
Command: ~/git-repo/mine-repo/printer_products/android/gradlew app:properties
Please review your Gradle project setup in the android/ folder.
pubspec
dependencies:
flutter:
sdk: flutter
#firebase_auth: ^0.5.11
firebase_auth: ^0.6.6
google_sign_in: ^3.0.4
firebase_core: ^0.2.5+1
cloud_firestore: ^0.7.3
firebase_storage: ^1.0.4
image_picker: ^0.4.10
http: ^0.12.0
uuid: ^1.0.3
mime: ^0.9.6+2
shared_preferences: "^0.4.3"
rxdart: "^0.19.0"
scoped_model: "^1.0.1"
Seems that only the combination of firebase_auth: 0.5.11 and google_sign_in: 3.0.4 works.
When I realized that the problem was not caused directly by the package and its update, I found the solution on this question. I simply removed the cache mentioned on the error: rm -rf ~/.gradle/caches/4.10.2
i want to implement the notifications feature by firebase on my ionic application
so after proceeding with the following command
ionic cordova plugin add cordova-plugin-fcm
and adding the google-services.json to the main folder of my ionic project I am facing the following error with no success to solve it
(node:15256) UnhandledPromiseRejectionWarning: Unhandled promise rejection
(rejection id: 1): TypeError: Invalid data, chunk must be a string or
buffer, not object
(node:15256) [DEP0018] DeprecationWarning: Unhandled promise rejections are
deprecated. In the future, promise rejections that are not handled will
terminate the Node.js process with a non-zero exit code.
i found on google that firebase has several bugs on it's latest version which is 4.8.2 and 4.8.1 so as well i did a downgrade to firebase 4.8.0.
as well i tried the npm install and npm cache verify and i checked that i have the same package name in my project and firebase with no success to solve it.