firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.71k stars 3.97k forks source link

Could not resolve com.google.firebase:firebase-analytics:16.5.0. #2649

Closed RaitonGG closed 4 years ago

RaitonGG commented 4 years ago

I'm trying to pick up an old project to add new features that users asked for but i'm getting weird errors:

`FAILURE: Build failed with an exception.

BUILD FAILED in 2s Running Gradle task 'assembleDebug'... Running Gradle task 'assembleDebug'... Done 3,9s Gradle task assembleDebug failed with exit code 1 `

here's my flutter doctor -v

`[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version 10.0.18362.778], locale pt-PT) • Flutter version 1.12.13+hotfix.9 at F:\Programas\Coding\Flutter\flutter • Framework revision f139b11009 (8 weeks ago), 2020-03-30 13:57:30 -0700 • Engine revision af51afceb8 • Dart version 2.7.2

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3) • Android SDK at D:\Users\RaitonGG\AppData\Local\Android\sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-R, build-tools 28.0.3 • ANDROID_HOME = D:\Users\RaitonGG\AppData\Local\Android\sdk • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04) • All Android licenses accepted.

[√] Android Studio (version 3.6) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin version 45.1.1 • Dart plugin version 192.7761 • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[√] Connected device (1 available) • 6044D • d71ca79 • android-arm • Android 5.1.1 (API 22)

• No issues found! `

app build.gradle dep dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' implementation 'com.google.firebase:firebase-ads:18.0.0' implementation 'com.android.billingclient:billing:2.0.3' }

build.gradle dep dependencies { classpath 'com.android.tools.build:gradle:3.3.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.41" classpath 'com.google.gms:google-services:4.2.0' }

gradle.properties org.gradle.jvmargs=-Xmx1536M android.enableJetifier=true android.useAndroidX=true android.enableR8=true

TahaTesser commented 4 years ago

Hi @RaitonGG Please upgrade to latest stable Flutter, update your pub packages, upgrade you gradle plugin to 3.5

You're using old Flutter, probably old packages, old gradle 3.3

if the problem persist after upgrade, please a create a new issues with all the details Thank you

RaitonGG commented 4 years ago

Upgraded flutter. my gradle plugin is 4.10.2 according to my gradle-wrapper.properties

same error

`FAILURE: Build failed with an exception.

BUILD FAILED in 33s Exception: Gradle task assembleDebug failed with exit code 1`

RaitonGG commented 4 years ago

ps. not sure why you closed an issue I didn't say was solved

TahaTesser commented 4 years ago

@RaitonGG As i mentioned earlier, this is because your old dependencies

Make sure to update following

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'
    }
}
        multiDexEnabled true
dependencies {
    def multidex_version = "2.0.1"
    implementation "androidx.multidex:multidex:$multidex_version"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.google.firebase:firebase-analytics:17.2.2'
}
apply plugin: 'com.google.gms.google-services'

don't forget o add google-services.json in your app folder inside android folder

No issues on my testing

if the problem persist persist after these, Can you please provide your flutter doctor -v after upgrade to latest stable, your flutter run --verbose and a minimal complete reproducible code sample Also include build.gradlefrom android folder, build.gradle with app folder

Thank you"

RaitonGG commented 4 years ago

Solved