2

When I try adding any of the the .jar files that are in my libs2 folder to my libs folder enter image description here

I get the following error:

    Information:Gradle tasks [:app:assembleDebug]
    Warning:Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
             In case of problem, please repackage it with jarjar to change the class packages
    Warning:Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.
             In case of problem, please repackage it with jarjar to change the class packages
    :app:preBuild UP-TO-DATE
   .....
    :app:compileDebugNdk UP-TO-DATE
    :app:compileDebugSources
    :app:transformClassesWithDexForDebug
    UNEXPECTED TOP-LEVEL EXCEPTION:
    Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
    > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_45\bin\java.exe'' finished with non-zero exit value 2

I know for a fact that the files in libs2 cause the error since I would add them one by one and see which ones would cause a problem or not, based on this persons suggestion.

I am following a tutorial which requires all of those .jar files, so I do not understand why I am getting those errors since they are necessary.

Community
  • 1
  • 1
bob dylan
  • 647
  • 1
  • 10
  • 25

2 Answers2

3

with Gradle no need to downgrade or to find another jar - since one can filter per group/module:

compile ('com.google.http-client:google-http-client-jackson2:1.21.0') {
    exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
Martin Zeitler
  • 1
  • 19
  • 155
  • 216
1

In 5.0 and above (api 23+) http client is depricated adn doesnt even exists downgrade your maxsdk or use url connection in your case you should find the latest jar files which are compatible with api23+

Adeel Turk
  • 897
  • 8
  • 23