android: Third party library jar uses a library I plan to use, causing dalvik error "Unable to execute dex: Multiple dex files define"

StackOverflow https://stackoverflow.com/questions/21383941

Question

"Unable to execute dex: Multiple dex files define Lcom/android/volley/toolbox/NetworkImageView"

This compiler or linker error is popping up because a third party jar file is using some Volley methods to queue network requests, and I want to use Volley an android library for the rest of my project.

How do I make this project compile? I've seen similarly worded questions that don't solve this problem

Was it helpful?

Solution

Rename package name of the conflicted library.

You can use Maven Shade Plugin if you use Maven or Jarjar You can find an example of the configuration of Maven Shade plugin here

OTHER TIPS

It's like a conflict like two computers with same IP address.

Like you add v4 support library and if you are using a library which also has v4 then this error occurs.

You have two versions of Volleys, one in your third party and other as it is which you are using

You need to remove one of them add your volley packages in that library only

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top