You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Oscar Bastidas <ob...@umn.edu> on 2019/02/16 02:27:59 UTC

HttpClient for Android Question

Hello,

I am getting into Java software development totally developed on my Android
tablet-no use of a "real" computer.  I have noticed that the Java package I
am using (the ecj compiler on the Termux emulator) doesn't have the
HttpClient library installed on it and that the download files available on
hc.apache.org do not appear to be compatible with the Termux setup I have
(I confess I am somewhat of a novice and "teaching myself," on this craft
but this is my understanding so far).  For some background, Termux is a
Linux emulator that turns Java code into class and dex files that dalvik,
our virtual machine then executes.

My question is, can the HttpClient library available on Apache for Java be
used directly on an Android device coding Java?  If so, what is the setup
involved?  I believe there is an Android version coming available at some
point, but my fear is that these will be traditional .jar files for use in
Android development on a traditional Linux, Windows or Mac machine as
opposed to the Linux-like Termux environment which cannot run jar files.

Thanks, and any resources or ideas you can point me to in this journey will
be greatly appreciated.

Oscar

Re: HttpClient for Android Question

Posted by Oscar Bastidas <ob...@umn.edu>.
Thanks.

Oscar

Oscar Bastidas, Ph.D.
Postdoctoral Research Associate
University of Minnesota

On Sun, Feb 17, 2019, 6:47 AM Oleg Kalnichevski <ol...@apache.org> wrote:

> On Sun, 2019-02-17 at 01:06 -0600, Oscar Bastidas wrote:
> > Hello Oleg,
> >
> > Thank you for your kind response.  I have Android 8.1 on my device
> > and I
> > think I'd like to give the 5.0 package a shot.
> >
> > That being said, I do have two follow-up questions that I would like
> > to ask
> > you:
> >
> > 1) I noticed that to get the 4.3.5.1 package via the link you gave
> > me, I
> > need to type the following somewhere:
> >
> > dependencies {
> >     compile group: 'org.apache.httpcomponents' , name:
> > 'httpclient-android' , version: '4.3.5.1'
> > }
> >
> >
> > Is this supposed to go in the gradle file (which assumes Android app
> > development with gradle files, XML, etc...)
>
> Yes, it is.
>
>
> >  and if so, is there an
> > alternative way to incorporate the package so it can be used into
> > just
> > plain Java (powered by ecj compiler for instance) by command
> > line?  Perhaps
> > using something comparable to:
> >
>
> I cannot say. I have limited experience with Android development and I
> have always been using Gradle.
>
>
> > 2) Keeping my 'pure Java only' paradigm in mind, If I want to get the
> > 5.0
> > version, are the downloads available from the following link what I
> > should
> > be looking at?
> >
> > http://hc.apache.org/downloads.cgi
> >
> > If so, which should I take?  The binary (tar or zip?)?  Or the source
> > (tar
> > or zip?)?
>
> Binary unless we want to build the artifacts from source.
>
>
> >  Where should they be saved, unzipped and once they've been saved
> > in the right location and unzipped, do they require further
> > processing or
> > can I at that point just use the import command in my Java program
> > like
> > importing any other native library (i.e. 'import util.*;')?
> >
>
> I cannot say.
>
> Oleg
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>

Re: HttpClient for Android Question

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sun, 2019-02-17 at 01:06 -0600, Oscar Bastidas wrote:
> Hello Oleg,
> 
> Thank you for your kind response.  I have Android 8.1 on my device
> and I
> think I'd like to give the 5.0 package a shot.
> 
> That being said, I do have two follow-up questions that I would like
> to ask
> you:
> 
> 1) I noticed that to get the 4.3.5.1 package via the link you gave
> me, I
> need to type the following somewhere:
> 
> dependencies {
>     compile group: 'org.apache.httpcomponents' , name:
> 'httpclient-android' , version: '4.3.5.1'
> }
> 
> 
> Is this supposed to go in the gradle file (which assumes Android app
> development with gradle files, XML, etc...)

Yes, it is.


>  and if so, is there an
> alternative way to incorporate the package so it can be used into
> just
> plain Java (powered by ecj compiler for instance) by command
> line?  Perhaps
> using something comparable to:
> 

I cannot say. I have limited experience with Android development and I
have always been using Gradle.


> 2) Keeping my 'pure Java only' paradigm in mind, If I want to get the
> 5.0
> version, are the downloads available from the following link what I
> should
> be looking at?
> 
> http://hc.apache.org/downloads.cgi
> 
> If so, which should I take?  The binary (tar or zip?)?  Or the source
> (tar
> or zip?)? 

Binary unless we want to build the artifacts from source.


>  Where should they be saved, unzipped and once they've been saved
> in the right location and unzipped, do they require further
> processing or
> can I at that point just use the import command in my Java program
> like
> importing any other native library (i.e. 'import util.*;')?
> 

I cannot say.

Oleg



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: HttpClient for Android Question

Posted by Oscar Bastidas <ob...@umn.edu>.
Hello Oleg,

Thank you for your kind response.  I have Android 8.1 on my device and I
think I'd like to give the 5.0 package a shot.

That being said, I do have two follow-up questions that I would like to ask
you:

1) I noticed that to get the 4.3.5.1 package via the link you gave me, I
need to type the following somewhere:

dependencies {
    compile group: 'org.apache.httpcomponents' , name:
'httpclient-android' , version: '4.3.5.1'
}


Is this supposed to go in the gradle file (which assumes Android app
development with gradle files, XML, etc...) and if so, is there an
alternative way to incorporate the package so it can be used into just
plain Java (powered by ecj compiler for instance) by command line?  Perhaps
using something comparable to:

pkg install ecj dx

for a linux environment where after executing the above, simply importing
HttpClient into a java file is all that's necessary (i.e. 'import
HttpClient;')?  In all honesty, I am trying to avoid actual Android app
development at this particular point in my journey, I am just interested in
using the raw Java coding abilities available on my Termux Linux emulator
so that I can stengthen my Java skills before I get into the more complex
world of actual app development.

2) Keeping my 'pure Java only' paradigm in mind, If I want to get the 5.0
version, are the downloads available from the following link what I should
be looking at?

http://hc.apache.org/downloads.cgi

If so, which should I take?  The binary (tar or zip?)?  Or the source (tar
or zip?)?  Where should they be saved, unzipped and once they've been saved
in the right location and unzipped, do they require further processing or
can I at that point just use the import command in my Java program like
importing any other native library (i.e. 'import util.*;')?

If what I'm trying to do here as described above is impossible, or too
exceedingly complicated, please do let me know.

Thank you again for your help and I hope my above questions aren't too
burdensome!

Oscar

On Sat, Feb 16, 2019, 6:42 AM Oleg Kalnichevski <ol...@apache.org> wrote:

> On Fri, 2019-02-15 at 20:27 -0600, Oscar Bastidas wrote:
> > Hello,
> >
> > I am getting into Java software development totally developed on my
> > Android
> > tablet-no use of a "real" computer.  I have noticed that the Java
> > package I
> > am using (the ecj compiler on the Termux emulator) doesn't have the
> > HttpClient library installed on it and that the download files
> > available on
> > hc.apache.org do not appear to be compatible with the Termux setup I
> > have
> > (I confess I am somewhat of a novice and "teaching myself," on this
> > craft
> > but this is my understanding so far).  For some background, Termux is
> > a
> > Linux emulator that turns Java code into class and dex files that
> > dalvik,
> > our virtual machine then executes.
> >
> > My question is, can the HttpClient library available on Apache for
> > Java be
> > used directly on an Android device coding Java?
>
> Hi Oscar
>
> HttpClient 5.0 most likely yes, HttpClient 4.5 almost certainly no. I
> am working on making stock HttpClient 4.5 compatible with Android 9
> (API 28).
>
> > If so, what is the setup
> > involved?  I believe there is an Android version coming available at
> > some
> > point, but my fear is that these will be traditional .jar files for
> > use in
> > Android development on a traditional Linux, Windows or Mac machine as
> > opposed to the Linux-like Termux environment which cannot run jar
> > files.
> >
>
> If you want a fork of HttpClient 4.x compatible with earlier versions
> of Android please see
>
> http://hc.apache.org/httpcomponents-client-4.5.x/android-port.html
>
> Otherwise please consider using HttpClient 5.0.
>
> Hope this helps.
>
> Oleg
>
>
> > Thanks, and any resources or ideas you can point me to in this
> > journey will
> > be greatly appreciated.
> >
> > Oscar
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>

Re: HttpClient for Android Question

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, 2019-02-15 at 20:27 -0600, Oscar Bastidas wrote:
> Hello,
> 
> I am getting into Java software development totally developed on my
> Android
> tablet-no use of a "real" computer.  I have noticed that the Java
> package I
> am using (the ecj compiler on the Termux emulator) doesn't have the
> HttpClient library installed on it and that the download files
> available on
> hc.apache.org do not appear to be compatible with the Termux setup I
> have
> (I confess I am somewhat of a novice and "teaching myself," on this
> craft
> but this is my understanding so far).  For some background, Termux is
> a
> Linux emulator that turns Java code into class and dex files that
> dalvik,
> our virtual machine then executes.
> 
> My question is, can the HttpClient library available on Apache for
> Java be
> used directly on an Android device coding Java?  

Hi Oscar

HttpClient 5.0 most likely yes, HttpClient 4.5 almost certainly no. I
am working on making stock HttpClient 4.5 compatible with Android 9
(API 28).

> If so, what is the setup
> involved?  I believe there is an Android version coming available at
> some
> point, but my fear is that these will be traditional .jar files for
> use in
> Android development on a traditional Linux, Windows or Mac machine as
> opposed to the Linux-like Termux environment which cannot run jar
> files.
> 

If you want a fork of HttpClient 4.x compatible with earlier versions
of Android please see

http://hc.apache.org/httpcomponents-client-4.5.x/android-port.html

Otherwise please consider using HttpClient 5.0.

Hope this helps.

Oleg


> Thanks, and any resources or ideas you can point me to in this
> journey will
> be greatly appreciated.
> 
> Oscar


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org