android : Error converting byte to dex

后端 未结 30 1697
鱼传尺愫
鱼传尺愫 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:53

    This problem is mainly in gradle or in misversioned libraries, including, from libraries, when both define the same class. Expand and check, imported external libraries...

    You cannot have two same classes to be exported to one place, or code, therefore, dexer does not know which one should be used...

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

    My project used an external library with heterogeneous Java compatibility versions in my build.gradle files (1.7 and 1.8). I fixed it by using the same version for the lib and for the app project. In my case for both :

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
        }
    
    0 讨论(0)
  • 2020-12-01 10:54

    If you have multiple projects, make sure you are not adding a dependency multiple times, I needed to exclude the other project's dependency like this:

    compile(project(':OtherProject-SDK')) {
        compile.exclude module: 'play-services-gcm'
        compile.exclude module: 'play-services-location'
        compile.exclude module: 'support-v4'
        compile.exclude module: 'okhttp'
    }
    
    0 讨论(0)
  • 2020-12-01 10:55

    In my case the problem was because of capital letters in some packages.

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

    In my case, this was due to my library not being configured as 'android'. E.g. apply plugin:'java' instead of apply plugin:'com.android.library'

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

    I found in my case, this issue was caused by an improper configuration of build.gradle. I had two different versions of com.google.firebase. Once the versions were the same, the issue was solved

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