简体   繁体   中英

Android HTTP connection refused error even after appropriate permissions

I have this in my manifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.*****.****">
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

and this code in doInBackground (I know HttpGet is deprecated)

        HttpClient httpclient = new DefaultHttpClient();
        HttpGet request = new HttpGet();
        URI website = new URI(url);
        request.setURI(website);
        HttpResponse response = httpclient.execute(request);

getting org.apache.http.conn.HttpHostConnectException: Connection to http://127.0.0.1:8080 refused error. Help me

the ip addres 127.0.0.1 mean loopback. find right ip address.

what is loopback: https://en.wikipedia.org/wiki/Loopback

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM