dialogflow / dialogflow-android-client

Android SDK for Dialogflow
https://dialogflow.com
Apache License 2.0
574 stars 270 forks source link

HttpClient cannot be used in the same project with dialogflow #109

Closed zboing closed 5 years ago

zboing commented 5 years ago

If a project which has the line: useLibrary 'org.apache.http.legacy' in build.gradle file, the user will notice that whenever decides to use a get request using an AsyncTask from web the following error occurs:

E/AndroidRuntime: FATAL EXCEPTION: AsyncTask java.lang.RuntimeException: An error occurred while executing doInBackground() Caused by: java.lang.NoSuchMethodError: No virtual method execute(Lorg/apache/http/client/methods/HttpUriRequest;)Lorg/apache/http/client/methods/CloseableHttpResponse; in class Lorg/apache/http/impl/client/DefaultHttpClient; or its super classes (declaration of 'org.apache.http.impl.client.DefaultHttpClient' appears in /system/framework/org.apache.http.legacy.boot.jar)

This happens because one of the imports from this project implementation 'ai.api:sdk:2.0.7@aar' implementation 'ai.api:libai:1.6.12' already contains a httpclient class.

zboing commented 5 years ago

I've found a solution by using Volley library and it works.