Skip to content Skip to sidebar Skip to footer

Multiple Dex Files Define Landroid/support/v7/util/threadutil$mainthreadcallback Error

Error occurs only when I'm trying to take release or debug apk of my app. I can run or debug it on my device straight from Android Studio. From this question, I understood that thi

Solution 1:

Per your comment, apparently the issue was a third-party SDK that distributed a JAR of recyclerview-v7, that you had in libs/, which conflicted with your recyclerview-v7 dependency.

There are downsides to using plain JARs for dependencies.

One is that you tend to forget about them, particularly if you also are using dependencies from artifact repositories. For example, I didn't even consider that you might have JARs in libs/ in my comment.

Another is that Gradle cannot perform any sort of dependency resolution for them. Gradle relies on artifact metadata (POM files) for determining what dependencies are required. Gradle assumes that "you're doing the right thing" with respect to JAR files, and in this case, your ad network's one JAR isn't "the right thing".

Also, JARs are JARs, not AARs. In this case, the engineers at your ad network are very strange people. recyclerview-v7 has resources in its AAR that RecyclerView needs (e.g., custom attributes). Basically, by distributing a JAR containing RecyclerView code, they are dooming anyone using their SDK: nobody can use their RecyclerView because it is incomplete (and probably out of date), and nobody can use the official RecyclerView due to class conflicts.

At minimum, I recommend that you complain to the ad network, urging them to switch to using artifacts and a proper set of dependencies.

Post a Comment for "Multiple Dex Files Define Landroid/support/v7/util/threadutil$mainthreadcallback Error"