I already have developed an desktop application using Java and now I need to develop the same application to Android. In my java application I've used the httpclient library from apache to make all http transactions, my question is: Can I use the same class HttpUtil that I've used in my java application with HttpClient in my new Android app ???
Asked
Active
Viewed 1,758 times
1 Answers
2
Yes. Much, most, or all of your code can work in Android. Just make sure to continue using the Apache imports and not Google's (near) equivalents.
For example, instead of:
import com.google.api.client.http.HttpResponse;
Make sure you continue to use this:
import org.apache.http.HttpResponse;

David Manpearl
- 12,362
- 8
- 55
- 72
-
I don't think it's possible look what I'm getting when I try to run my android application: [2013-03-21 11:35:13 - Dex Loader] Unable to execute dex: Multiple dex files define Lorg/apache/http/ConnectionClosedException; [2013-03-21 11:35:13 - TargetAppAndroid] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lorg/apache/http/ConnectionClosedException; – Victor Laerte Mar 21 '13 at 14:39
-
It appears to be a compile issue that may involve clean/refresh or tools update. Check http://stackoverflow.com/questions/7870265/unable-to-execute-dex-multiple-dex-files-define-lcom-myapp-rarray/7884908#7884908 and http://stackoverflow.com/questions/9122377/android-unable-to-execute-dex. – David Manpearl Mar 21 '13 at 23:05
-
You were right. I was importing HttpClient lib, but it is available in Android default libs, my mistake. – Victor Laerte Mar 22 '13 at 12:34