0

I've read article this in backendless and this and this in StackOverflow. But there isn't any help for me. I searched everywhere but there isn't any solution.The error is bellow

Error:Execution failed for task ':app:transformClassesWithDexForDebug'.

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/android/volley/VolleyError;

In build.gradle

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.1'
androidTestCompile 'com.mcxiaoke.volley:library:1.0.18'
compile project(":volley")
compile 'com.mcxiaoke.volley:library:1.0.18'

}

This error will disappear when removing compile 'com.mcxiaoke.volley:library:1.0.18' in build.gradle.

What I need to be done is pass the data within app and server(localhost). To pass the string I'm using JSON. In android app using Volley libraries.

What would be I missed? Thank you

E J Chathuranga
  • 927
  • 12
  • 27
  • Please provide a [mcve]. This would include the `build.gradle` file, or at least all of its `dependencies`, that is triggering this build error. Also, please explain **in detail** what "the JSON doesn't flow same as before done" means. – CommonsWare Jun 26 '17 at 15:47
  • I'm edited my question and thanks for your attention @CommonsWare – E J Chathuranga Jun 26 '17 at 16:16
  • Why do you have both a Volley library module *and* an out of date dependency? Use the official dependency instead of both of those. – CommonsWare Jun 26 '17 at 16:26
  • If I'm no bothering you @CommonsWare can you tell me please what are the out of date dependencies and official dependencies?. I'm searching everywhere but there aren't any references. Thank you – E J Chathuranga Jun 26 '17 at 16:37

1 Answers1

1

I'm searching everywhere but there aren't any references

The documentation shows that Google's official Volley artifact is available via:

compile 'com.android.volley:volley:1.0.0'

Use that instead of com.mcxiaoke.volley:library:1.0.18, which was published two years ago.

Now, you also have compile project(":volley"). I do not know why. Use either com.android.volley:volley:1.0.0 or compile project(":volley"), not both. Unless you have some specific reason for using the library module (e.g., you are forking Volley), I would recommend using the com.android.volley:volley:1.0.0 artifact.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491