在flutter中添加Firebase身份验证插件后出现':app:transformDexArchiveWithExternalLibsDexMergerForDebug'错误 [英] ':app:transformDexArchiveWithExternalLibsDexMergerForDebug' error after adding firebase auth plugin in flutter

查看:72
本文介绍了在flutter中添加Firebase身份验证插件后出现':app:transformDexArchiveWithExternalLibsDexMergerForDebug'错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在安装firebase_auth插件并更新其他firebase插件版本后,出现一些错误.我尝试了一些解决方案,包括降级firebase auth插件版本并在gradle文件中添加了几行,但是仍然无法正常工作.

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

错误:

    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,

推荐答案

一天前,我遇到了这样的问题.这可能是您的依赖项中的支持库和androidx之间的冲突.看看问题.以我为例,我解决了这个问题,从pubspec中的项目中手动删除了所有依赖项,并使用已经使用androidx的新更新版本逐一添加,并且也迁移了我的项目.好吧,我尝试IDE androidX迁移工具,但没有成功.最后,要了解第三部分库,其中一些需要花费一些时间来更新和创建类似的问题.

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.

这篇关于在flutter中添加Firebase身份验证插件后出现':app:transformDexArchiveWithExternalLibsDexMergerForDebug'错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆