I tried to configure my flutter project in order to use firebase. I added all the dependency and couldn't sync after adding the lines mentioned in the firebase to Gradle build.
How do I sync in vscode.
added depenency for firebase:
In project -> android -> app -> build.gradle :
apply plugin: 'com.google.gms.google-services'
In project -> gradle -> build.gradle:
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
**classpath 'com.google.gms:google-services:4.3.3'**
}
IN project -> pubspec.yaml
firebase_auth: ^0.14.0+5
Also ran flutter pub get
Error log:
* Error running Gradle:
ProcessException: Process "C:\Users\LENOVO\Documents\flutter_apps\time_tracker_flutter_course\android\gradlew.bat" exited abnormally:
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\LENOVO\Documents\flutter_apps\time_tracker_flutter_course\android\app\build.gradle' line: 24
* What went wrong:
A problem occurred evaluating project ':app'.
> ASCII
* 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 2m 23s
Command: C:\Users\LENOVO\Documents\flutter_apps\time_tracker_flutter_course\android\gradlew.bat app:properties
Please review your Gradle project setup in the android/ folder.
Exited (sigterm)
When using Firebase, you need to download the google-services.json file and add it to your project:
Where do I place Googleservices.json in Flutter app in order to solve 'google-services.json is missing'
Then in the android/build.gradle, you need to add the google() maven repository:
buildscript {
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
}
dependencies {
...
// Add this line
classpath 'com.google.gms:google-services:4.3.3'
}
}
allprojects {
...
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
...
}
}
and inside android\app\build.gradle, you need to add the google-service plugin:
apply plugin: 'com.google.gms.google-services'
Check this:
https://firebase.google.com/docs/flutter/setup?platform=android
Related
I am trying to configure a project that uses react-native and google firebase native.
The set up for react-native worked fine, but I ran into a problem with google firebase native.
I followed the instructions at rnfirebase.io.
When I try to sync My project with gradle files from Android Studio, I get the following error:
Build file 'C:\github\flashcards\flashcards\android\app\build.gradle' line: 139
A problem occurred evaluating project ':app'.
> Could not find method plugins() for arguments [build_2psolmxgn6smlx7165ef739cv$_run_closure1$_closure5#1b639892] on extension 'android' of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension.
* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
...
Here is the relevant portion of my /android/build.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
...
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.2.1")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("de.undercouch:gradle-download-task:5.0.1")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath('com.google.gms:google-services:4.3.14')
}
}
allprojects {
repositories {
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
mavenCentral {
// We don't want to fetch react-native from Maven Central as there are
// older versions over there.
content {
excludeGroup "com.facebook.react"
}
}
google()
maven { url 'https://www.jitpack.io' }
}
}
I added the following two lines to the top of my /android/app/build.gradle file:
apply plugin: "com.android.application"
apply plugin: 'com.google.gms.google-services'
Any suggesions for how to fix this problem?
I expected the Sync Project with Gradle files command to complete successfully, but I receive the error described above.
when i try to run the app it shows me this error
Launching lib\main.dart on sdk gphone x86 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
What went wrong: Could not determine the dependencies of task ':firebase_core:compileDebugAidl'.
Could not resolve all task dependencies for configuration ':firebase_core:debugCompileClasspath'.
Could not find com.google.firebase:firebase-common:.
Required by:
project :firebase_core
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 7s Exception: Gradle task assembleDebug failed with
exit code 1
i m using latest version of firebase_core
i have added firebse to my project
the build.gradle
rootProject.ext {
set('FlutterFire', [
FirebaseSDKVersion: '25.12.0'
])
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation platform('com.google.firebase:firebase-bom:28.2.1')
implementation "com.google.firebase:firebase-analytics"
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
.....
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.8'
}
}
i resolved this problem by deleting
the
root.text of the firebase version it is in the
/build.gradle
and i built the project again.
Error Log:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'Mobile'.
> Could not create task ':debug'.
> Unnecessarily replacing a task that does not exist is not supported. Use create() or register() directly instead. You attempted to replace a task named 'debug', but there is no existing task with that name.
* 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.
Anyway, heard something about it not supporting newer Gradle versions - if that is the case, to which older version Gradle should I downgrade?
My build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.17'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
}
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'application'
mainClassName = 'Mobile.Main'
dependencies {
testImplementation 'junit:junit:4.13'
}
So guys i'am newbie at Flutter and i have my Flutter Project using Firebase Auth for user login. I have following the tutorial from youtube: https://www.youtube.com/watch?v=aaKef60iuy8 by guy called Andrea Bizzotto. I have follow 3 part of his videos regarding to this Firbase Auth tutorial. He suggest to latest firebase_auth dependecies, and according to pub.dev the latest dependecies of firebase_auth is
0.15.0+1, but he use the 0.5.4. However, if i use the 0.15.0+1 one i got some error at FirebaseAuth.instance, so i use the 0.5.4 dependecies. But it caused error to my gradle when building the project. The debug console throw me this:
[Debug Console Error Message][1]
And before make this post, i have tried to find any solution regarding to this error. So what have tried to do is:
Adding
classpath 'com.google.gms:google-services:4.3.2' and changing classpath 'com.android.tools.build:gradle:3.2.1' to
classpath 'com.android.tools.build:gradle:3.5.1' in (android/build.gradle)
Adding
multidexEnabled = true at defaultConfig, implementation 'com.google.firebase:firebase-analytics:17.2.0' implementation
'com.google.firebase:firebase-firestore:19.0.0' implementation
'com.android.support:multidex:1.0.3' at dependencies also apply
plugin: 'com.google.gms.google-services' at the bottom of
(android\app\buid.gradle) file
I'm also adding
android.useAndroidX=true
android.enableJetifier=true
org.gradle.daemon=true
org.gradle.parallel=true in gradle.properties file
Here is my flutter doctor -v result
[Flutter doctor -v Result][2]
Any Help is very much appreciated.
[1]: https://i.stack.imgur.com/60j9S.png [2]:
https://i.stack.imgur.com/9G8ug.png
you can try to update the build.grade from project root like this:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.3'
}
}
and then the distributionUrl in grade-wrapper.properties like this:
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
I got the answer from here: https://github.com/flutter/flutter/issues/41492
I am trying to find the steps to get flutter working with Firebase with a clean Install of a flutter project and Firebase setup. Here is the bare minimum setup of files per their instructions.
my pubspec.yaml
dev_dependencies:
flutter_test:
sdk: flutter
firebase_core: ^0.4.0+1
firebase_auth: ^0.11.1+3
cloud_firestore: ^0.12.9
my build.gradle file
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.3.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and my /buildgradle file, I just added to this to end (per firestore instructions)
apply plugin: 'com.google.gms.google-services'
I also put the google.services.json file into my android/app folder.
I then try to build and get this error:
FAILURE:
Build failed with an exception.
* Where:
Build file 'C:\Users\Mike\Documents\VSCode Projects\flutterplayground\graceblox\android\app\build.gradle' line: 24
* What went wrong:
A problem occurred evaluating project ':app'.
> ASCII
* 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 1s
Command: C:\Users\Mike\Documents\VSCode Projects\flutterplayground\graceblox\android\gradlew.bat app:properties
Does anyone have the basic setup working ?? I have searched and found all kinds of responses to change the versions, add androidx, etc..but nothing seems to work. I'm hoping there is a defined set of oonfigurion steps someone has to get this working?