0

I am getting some errors after installing the firebase_auth plugin and updating the other firebase plugin versions. I tried some solutions including downgrading the firebase auth plugin version and adding some lines to my gradle files but it is still not working.

pubspec.yaml:

 dependencies:
  flutter:
    sdk: flutter
  shared_preferences: ^0.4.3
  json_annotation: ^1.2.0
  geolocator: ^2.1.0
  auto_size_text: ^0.2.1
  firebase_storage: ^2.0.1
  firebase_core: ^0.3.0+1
  firebase_auth: ^0.6.2+1
  firebase_messaging: ^3.0.1
  flutter_advanced_networkimage: any
  image_picker: ^0.4.10
  url_launcher: ^4.0.1
  multi_image_picker: ^2.2.30
  intl: ^0.15.7
  path_provider: ^0.4.1
  sqflite: ^1.0.0
  rxdart: ^0.20.0

gradle.properties:

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

app/build.gradle:

android {
    compileSdkVersion 28

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId ****************
        minSdkVersion 21
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }

    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 'com.google.firebase:firebase-core:16.0.0' //added this as per comment below

    implementation 'com.google.firebase:firebase-auth:16.0.1'//added this as per comment below

    implementation 'com.google.firebase:firebase-messaging:17.0.0'//added this as per comment below

    implementation 'com.android.support:multidex:1.0.3'
    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-service

Error:

    Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.6.2+1\android\src\main\java\io\flutter\plugins\firebaseauth\FirebaseAuthPlugin.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-0.3.0+1\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_messaging-3.0.1\android\src\main\java\io\flutter\plugins\firebasemessaging\FlutterFirebaseInstanceIDService.java uses or overrides a deprecated API.
         *********************************************************
D8: Program type already present: android.support.v4.os.ResultReceiver$1

....message to visit a link....

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
    > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: some directory path ending with.jar,
DanT29
  • 3,069
  • 4
  • 24
  • 32

4 Answers4

1

I ended up fixing my error by following this: https://github.com/flutter/flutter/issues/27128#issuecomment-457918930

Here's some other notes:

  1. When updating the distributionUrl in gradle-wrapper.properties I used 4.10.2. Your version might be different depending when you do this I'm guessing.
  2. If you can't find the "Sync Project with Gradle Files" command follow this Not able to sync dependency in build.gradle in flutter
DanT29
  • 3,069
  • 4
  • 24
  • 32
1

Man i had a problem like this just one day ago. This is probably conflict between support library and androidx in your dependencies. Take a look at this issue. In my case i solve this manually removing all dependencies from my project in pubspec and add one by one with new updated version that already use androidx and migrate my project too. Well i try IDE androidX migration tool but without success. Finally be aware with thrid part libraries some of them take a time to update and create problems like this.

Marcos Boaventura
  • 4,641
  • 1
  • 20
  • 27
  • I came across that issue thread as well, eventually I had to do what you just mentioned following steps in a link I posted in my answer. It seemed to fix my error, hopefully nothing else pops up. – DanT29 Feb 15 '19 at 23:25
  • 1
    I spend an entire day to solve this problem, hopefully we got solution now. – Marcos Boaventura Feb 15 '19 at 23:33
0

Upgrade your whole firebase plugins as new

Privacy of Animal
  • 441
  • 2
  • 10
  • 17
0

I had same problem and i updated as follows

compile 'com.google.firebase:firebase-core:11.0.4'
compile 'com.google.firebase:firebase-auth:11.0.4'
compile 'com.google.firebase:firebase-messaging:11.0.4'

to

implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.0.0'

Check latest version and update accordingly https://firebase.google.com/support/release-notes/android

Farid Haq
  • 3,728
  • 1
  • 21
  • 15