--MyProject (module)
--build.gradle
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile project ':MyLib'
}
--MyLib (module)
--build.gradle
dependencies {
compile 'com.mcxiaoke.volley:library:1.0.16'
compile 'com.google.code.gson:gson:2.3.1'
}
In my library module called MyLib, I've added (for example) Gson & Volley as library.
I wish to use Gson and Volley api in the MyProject module without adding the libraries again as dependencies but I can't. And when I add Gson or Volley in the MyProject build.gradle, it causes an error:
multiple dex files define
How can I reuse dependencies that already added in the MyLib module? If this is not possible, how do I avoid this multiple dex files define error? I've tried Android Studio Gradle Error: Multiple dex files define
dexOptions {
preDexLibraries = false
}
but it didn't help.
Thanks in advance.