I've added the cloud_firestore: ^0.9.0 package to my new flutter project, so I created a new flutter project just for testing the Firebase package.
and got this error, after "package get", and starting the project.
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
Gradle task 'assembleDebug'...
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not resolve com.google.firebase:firebase-firestore:17.1.0.
Required by:
project :app > project :cloud_firestore
> Could not resolve com.google.firebase:firebase-firestore:17.1.0.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-firestore/17.1.0/firebase-firestore-17.1.0.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-firestore/17.1.0/firebase-firestore-17.1.0.pom'.
> Connect to dl.google.com:443 [dl.google.com/172.217.19.110] failed: Connection timed out: connect
> Could not resolve com.google.firebase:firebase-firestore:17.1.0.
> Could not get resource 'https://jcenter.bintray.com/com/google/firebase/firebase-firestore/17.1.0/firebase-firestore-17.1.0.pom'.
> Could not GET 'https://jcenter.bintray.com/com/google/firebase/firebase-firestore/17.1.0/firebase-firestore-17.1.0.pom'.
> Connect to jcenter.bintray.com:443 [jcenter.bintray.com/52.28.74.46, jcenter.bintray.com/52.28.100.213] failed: Connection timed out: connect
> Could not resolve com.google.firebase:firebase-firestore:17.1.0.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-firestore/17.1.0/firebase-firestore-17.1.0.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-firestore/17.1.0/firebase-firestore-17.1.0.pom'.
> Connect to dl.google.com:443 [dl.google.com/172.217.19.110] failed: Connection timed out: connect
> Could not resolve com.google.firebase:firebase-firestore:17.1.0.
> Could not get resource 'https://jcenter.bintray.com/com/google/firebase/firebase-firestore/17.1.0/firebase-firestore-17.1.0.pom'.
> Could not GET 'https://jcenter.bintray.com/com/google/firebase/firebase-firestore/17.1.0/firebase-firestore-17.1.0.pom'.
> Connect to jcenter.bintray.com:443 [jcenter.bintray.com/52.28.100.213, jcenter.bintray.com/52.28.74.46] failed: Connection timed out: connect
* 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 7s
Finished with error: Gradle task assembleDebug failed with exit code 1
Steps to recreate:
- Copy the firebase package version for pubspec.yaml cloud_firestore: ^0.9.0 and add this to the pubspect.yamel file. and do package get.
- Downloaded google-services.json after creating an account on the firebase website.
FLUTTERAPP/android/buld.grundle ive added this line of code
classpath 'com.google.gms:google-services:4.2.0'
FLUTTERAPP/android/app/build.grundle at the end i've added this like of code
apply plugin: 'com.google.gms.google-services'
started the app..
I'm using android studio with an Android emulator, on windows 10
MY_APP/android/buld.randle
buildscript {
ext.kotlin_version = '1.2.71'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.2.0'
}
}
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
}
MY_APP/android/app/build.grundle
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 27
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.newapp"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'