i/o failure: java.net.UnKnownHostException - java

Working on an Android application...
I'm getting this error message:
i/o failure: java.net.UnKnownHostException: Unable to resolve host
"api.parse.com": No address associated with hostname
Many suggest to add internet permission in the manifest file, I have these permissions already:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Any suggestions?
Thanks!

I'm guessing that the device is
not connected to the private LAN that has
the DNS server that resolves the hostname. The emulator shares the network
connectivity of its host; not so the
real device.
The error says that the dns server the device is talking to can't resolve
the name. It may also mean we can't talk to the dns server.
You have these two entries in AndroidManifest.xml file:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
I don't think there might be other reason for that except the connection.

Related

Still getting those SMS and CALL_LOG warning in Google Play console, when my app DOESNT use these permissions?

I got this message sometimes above my app in the Dashboard menu. Sometimes it is here, sometimes it is not. What the heck is going on here, my app uses the following permissions:
ACCESS_NETWORK_STATE
INTERNET
Also, I double checked it:
when I install app on phone, and check on phone => apps => permissions, there are none other permission except those listed above
So I am pretty much 100% sure I dont use these permissions, but I still see the warning. Why? It simply must be a bug or something... ? i want to contact google play support please give me a direct link to the issue, or another solution, i also make new update with those changes below
<uses-permission
android:name="android.permission.RECEIVE_SMS"
tools:node="remove" />
<uses-permission
android:name="android.permission.READ_SMS"
tools:node="remove" />
<uses-permission
android:name="android.permission.SEND_SMS"
tools:node="remove" />
<uses-permission
android:name="android.permission.WRITE_SMS"
tools:node="remove" />
<uses-permission
android:name="android.permission.RECEIVE_WAP_PUSH"
tools:node="remove" />
<uses-permission
android:name="android.permission.RECEIVE_MMS"
tools:node="remove" />
<uses-permission
android:name="android.permission.READ_CALL_LOG"
tools:node="remove" />
<uses-permission
android:name="android.permission.WRITE_CALL_LOG"
tools:node="remove" />
<uses-permission
android:name="android.permission.PROCESS_OUTGOING_CALLS"
tools:node="remove" />
I had the same issue.
For that, I had just looked into Release management -> Artifact library-> Active artifacts, it was showing me an older active version(which have permissions of SMS) in the alpha version then after I had just uploaded new latest APK file(without SMS/Call permissions) in alpha version.
Finally, they removed warning from my console.
So, Firstly you have to check out that there is no other old alpha/beta versions are in active mode. I hope it will resolve your issue.

ConnectionException: Connection refused

I need to register with app on my tablet, but when I press the button "register" I get ConnectionException: Connection refused.
This is my endpoint:
public static String URL_REGISTER = "http://192.168.1.129/android_login_api/register.php";
MANIFEST:
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
I don't know why it doesn't work!
Can someone help me?

Activate flashlight when battery is lower than 10% in android API 21 and above

I'm trying to create an android flashlight app and I'm almost done. I'm facing one problem though. When the battery is below 10% the app starts but the flashlight doesn't come on.
minSdk is Api 21 (lollipop)
MaxSdk is Api 23 (M)
Below are the permissions and features included in AndroidManifest.xml.
<!--for controlling the camera flashlight-->
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<!--/-->
How do I get around this problem.

HttpUtils.httpConnection() refused

I have used this code to send an mms and all parameters are correct, but the connection is refused.. And the netWork is connected on mobile mms.
HttpUtils is a class from a library downloaded here : https://github.com/android/platform_packages_apps_mms
HttpUtils.httpConnection(getApplicationContext(), 4444L, MMSCenterUrl, bytesToSendFromPDU, HttpUtils.HTTP_POST_METHOD, !TextUtils.isEmpty(MMSProxy), MMSProxy, port);
06-29 19:51:26.208: I/Log MMSCenterUrl(13071): http: //mmsnrj
06-29 19:51:26.208: I/Log MMSProxy(13071): 10.143.156.5
06-29 19:51:26.208: I/Log MMSPort(13071): 8080
06-29 19:51:26.288: E/Mms:transaction(13071): Url: http: //mmsnrj
06-29 19:51:26.288: E/Mms:transaction(13071): Connection to http: //10.143.156.5:8080 refused
Manifiest file :
<uses-permission android:name="android.permission.WRITE_SMS" />
<uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
Crossing out usual suspects
Uses Internet permission in manifest file
Server is actually up.Please send a post request form the browser using Post master or any such tool
10.143.156.5 ip seems its an external system. Ensure that firewalls are not making your development life miserable. (Port forwarding or open the port on the routers)

Android: emulator unable to resolve hostname for local workstation

I'm trying to connect to a web app running my computer from the android emulator using the apache httpClient.
HttpPost post = new HttpPost("http://dev.example.com:8443/gatekeeper/rs/authenticate/login");
post.setHeader("Content-type","application/x-www-form-urlencoded");
post.setEntity(new UrlEncodedFormEntity(formparams));
HttpClient client=new DefaultHttpClient();
response = client.execute(post);
I do have the required android manifest configuration as below
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
I did check I can access the internet from the browser on the emulator. I can not access the app URL from the browser as well. My application also fails with an error
java.net.UnknownHostException: Unable to resolve host
"dev.example.com": No address associated with hostname
My application works fine when used with IP address of my computer. I also have entry in my hosts file
192.168.1.8 dev.example.com
What can I be missing here? It looks like android emulator can't look in to my hosts file to resolve the host name!
Please check the Connectivity programitically before calling for response
or If there is no response the also this exception is thrown

Categories