android : Error converting byte to dex

后端 未结 30 1698
鱼传尺愫
鱼传尺愫 2020-12-01 10:25

So, I am getting the following error while running the project after upgrading build.gradle (Project) from

dependencies {
        classpath \'com.android.too         


        
相关标签:
30条回答
  • 2020-12-01 10:58

    Before:

    compile 'com.google.android.gms:play-services-location:10.0.1'
    compile 'com.google.android.gms:play-services-auth:10.0.1'
    compile 'com.google.firebase:firebase-database:10.2.0'
    compile 'com.google.firebase:firebase-core:10.2.0'
    compile 'com.google.firebase:firebase-messaging:10.2.0'
    

    After:

    compile 'com.google.android.gms:play-services-location:10.2.0'
    compile 'com.google.android.gms:play-services-auth:10.2.0'
    compile 'com.google.firebase:firebase-database:10.2.0'
    compile 'com.google.firebase:firebase-core:10.2.0'
    compile 'com.google.firebase:firebase-messaging:10.2.0'
    

    Finally got resolved.

    0 讨论(0)
  • 2020-12-01 10:58

    First, build -> clean project -> rebuild it again.

    If its not working, then in your build.gradle, set the multiDexEnabled as true

    eg:

    defaultConfig {
        applicationId "com.example.myapplication"
        minSdkVersion 21
        targetSdkVersion 27
        multiDexEnabled true
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner"android.support.test.runner.AndroidJUnitRunner"
    }
    
    0 讨论(0)
  • 2020-12-01 10:59

    For me was very easy. Just add:

    //noinspection GradleDependency,GradleCompatible implementation 'com.google.android.gms:play-services-auth:11.0.4'

    ... and the magic happens.

    0 讨论(0)
  • 2020-12-01 11:00

    For some reasons, @ChintanSoni's answer didn't worked. I tried deleting the build folder manually but couldn't delete some files since they were being used by some process. Cleaning and re-building the project didn't help so I opened task manager, selected JAVA(TM) Platform SE binary and pressed on 'End task`.

    Then I tried to run the project once again and it started compiling fine.

    0 讨论(0)
  • In my case, I put

    apply plugin: 'com.google.gms.google-services'

    at the bottom of build.gradle file and set multiDexEnabled true in defaultConfig. Then just run and it works.

    0 讨论(0)
  • 2020-12-01 11:03

    Please add this block inside android in build.gradle

    dexOptions { preDexLibraries = false }

    0 讨论(0)
提交回复
热议问题