I get an error javax.net.sslException no trusted server certificate
for Android App on wi-fi connection, but my android app is working fine on 4.0 and above, I've tested.
Asked
Active
Viewed 1,730 times
1

Benjamin W.
- 46,058
- 19
- 106
- 116

Abhishek Kumar
- 11
- 7
-
Can you please provide Logcat output that shows the error? Initial thoughts: Have you tried a different wifi hotspot? Sometimes you are forced to visit a sign-in page before you can use wifi, and apps often respond to that redirection by giving an SSL error. This can vary across major Android versions. – acj Feb 02 '13 at 18:38
-
actually i made a one app its working fine on glaxy note & i tested my app on android app version 4.0 above its working but i tested one of my device which is of lower version throw error "" ssl connection something like that please help me out... – Abhishek Kumar Feb 02 '13 at 18:41
-
yes and I uses different wi-fi hot spot... – Abhishek Kumar Feb 02 '13 at 18:44
-
We need to see the exact error message (and preferably the full Logcat text that shows the crash) to help you fix the problem. What is the device model and Android version? – acj Feb 02 '13 at 18:48
-
Error Message "javax.net.sslException no trusted server certificate " But it doesn't throw in case of GALAXY NOTE N7000 ,s3, S2 on these device i tested all have version 4.0 and above bt i tested on micromax 2.3 GingerBread it throw the above error i mention. – Abhishek Kumar Feb 02 '13 at 18:51
-
hey do need any more further information if not then plz do reply. – Abhishek Kumar Feb 02 '13 at 19:08
1 Answers
0
The root cause is probably that the SSL certificate on your server is signed by a certificate authority (CA) that your older (Gingerbread) device doesn't recognize and therefore doesn't trust. This is a common problem if you're using a self-signed certificate. It can also happen if you're using a newer or less-known CA.
The ideal solution is to add your server's public certificate to your app's trusted store. (Example here.)
A far less ideal solution hack that would work for testing purposes is not to verify the certificate; but please be aware of the security risks!
EDIT:
On older Android devices, similar problems (such as this one) have been solved by switching from HttpClient
to HttpsUrlConnection
.
-
but i am not understanding y its giving error for android of lower version not on 4.0 and above if there is https problem then it throw error for all device. – Abhishek Kumar Feb 02 '13 at 20:26
-
@Abhisehek-Kumar Because the later version of Android has more root certificates pre-installed. In particular I am aware that Android 2.2 does not have GeoTrust root certificates. These appeared in 2.3. There appears to be a workaround: see this page: [link](http://www.geocerts.com/ssl/browsers) – Clyde Feb 02 '13 at 20:55
-
"These appeared in 2.3. There appears to be a workaround:" didn't get you plz explain it to me this is my first android app plz help me out. how i resolve this problem. – Abhishek Kumar Feb 02 '13 at 21:10