On Tue, 2013-01-08 at 01:02 -0800, ErwinZwart wrote:
> First of all my environment:
> 
> Android application using Eclipse
> httpclient-4.2.2.jar
> 
> This is my piece of intelligent code:
> 
> public class TestPCCManagerActivity extends Activity {
>     /** Called when the activity is first created. */
>     @Override
>     public void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.main);
> 
> //        SchemeRegistry reg = new SchemeRegistry();
> //        Scheme sch = new Scheme("http",  80,
> PlainSocketFactory.getSocketFactory());
>         
>           PoolingClientConnectionManager cm = new
> PoolingClientConnectionManager();
>         
>     }
> }
> 
> All builds fine.
> 
> When running the application I got into the Fatal exception telling me that
> org.apache.http.conn.scheme.Scheme.<init>  method is not found.
> 
> Further investigation seems that there the problem is when a new Scheme
> object is created. So I added the code (commented out in the example above)
> which is used inside the PoolingClientConnectionManager class:
> 
>         SchemeRegistry reg = new SchemeRegistry();
>         Scheme sch = new Scheme("http",  80,
> PlainSocketFactory.getSocketFactory());
> 
> I am getting an compile error telling me:
> 
> <http://httpcomponents.10934.n7.nabble.com/file/n18698/error.png> 
> 
> Searchiing the documentation it seems that this constructor is used for
> library 4.2.2. However the error tels met that it expects: new
> Scheme("http",  PlainSocketFactory.getSocketFactory(). 80);
> but this is, again according to the documentation, 4.1 and is deprecated.
> 
> documentation taken from:
> http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/conn/scheme/Scheme.html
> 
> <http://httpcomponents.10934.n7.nabble.com/file/n18698/scheme.png> 
> 
> I have absolutely  no idea. I also rebuilded the httpclient source code
> cause the code seems ok, but that did not help,
> 
> What am I missing here
> help...
> 

Android ships with a very outdated ALPHA version of HttpClient 4.0. One
cannot use newer versions of HttpClient on Android without moving all
the classes to a different namespace (org.apache.http ->
my.company.http). This is really a monumental f**kup but there is
nothing we can do about it until either Google completely removes old
HttpClient from their default Android distribution or we start producing
Android specific distribution of HttpClient (which is not likely to
happen soon).

There is already a repackaged version which you might want to try out:

http://code.google.com/p/httpclientandroidlib/

Oleg



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to