# \[solved\] Android app not connecting

**URL:** <https://forum.mattermost.com/t/solved-android-app-not-connecting/7704>\
**Category:** Mobile Apps\
**Created:** [July 17, 2019, 7:13pm UTC](https://forum.mattermost.com/t/solved-android-app-not-connecting/7704 "2019-07-17T19:13:18Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghosttie](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/ghosttie/32/3064_2.png) [@ghosttie](https://forum.mattermost.com/u/ghosttie)\
**Post date:** [July 17, 2019, 7:13pm UTC](https://forum.mattermost.com/t/solved-android-app-not-connecting/7704/1 "2019-07-17T19:13:18Z")

</div>

Mattermost was all set up and working but I had to move it to a new server which meant I could no longer use the default SSL port, which meant I could no longer use LetsEncrypt, so I bought a new SSL certificate.

It works using the browser and the Windows app, but the Android app says `Cannot connect to the server. Please check your server URL and internet connection.`

Doing a `systemctl status mattermost.service` gives me

`http: TLS handshake error from 192.168.0.143:41342: remote error: tls: unknown certific`

I looked through similar issues in this forum and saw that the problem might be intermediate CAs - the certificate came with a ca-bundle file but I wasn’t sure what to do with it.

The SSL provider (Sectigo) doesn’t provide any specific instructions for Mattermost.

Based on the conversations in the forums I tried renaming the bundle to .crt, copying it to `/usr/local/share/ca-certificates` and running `sudo update-ca-certificates` but it didn’t help.

---

<div class="post-metadata">

**Author:** ![amy.blais](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/amy.blais/32/7481_2.png) [@amy.blais](https://forum.mattermost.com/u/amy.blais)\
**Post date:** [July 19, 2019, 3:10pm UTC](https://forum.mattermost.com/t/solved-android-app-not-connecting/7704/2 "2019-07-19T15:10:14Z")

</div>

Hi @ghosttie, here are some troubleshooting steps that might help: [https://docs.mattermost.com/mobile/mobile-troubleshoot.html#i-keep-getting-a-message-cannot-connect-to-the-server-please-check-your-server-url-and-internet-connection](https://docs.mattermost.com/mobile/mobile-troubleshoot.html#i-keep-getting-a-message-cannot-connect-to-the-server-please-check-your-server-url-and-internet-connection).

---

<div class="post-metadata">

**Author:** ![ghosttie](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/ghosttie/32/3064_2.png) [@ghosttie](https://forum.mattermost.com/u/ghosttie)\
**Post date:** [July 19, 2019, 3:27pm UTC](https://forum.mattermost.com/t/solved-android-app-not-connecting/7704/3 "2019-07-19T15:27:58Z")

</div>

Yeah I did all that, and it says that if none of that works to open a topic in the forums, so here we are 🙂

---

<div class="post-metadata">

**Author:** ![amy.blais](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/amy.blais/32/7481_2.png) [@amy.blais](https://forum.mattermost.com/u/amy.blais)\
**Post date:** [July 23, 2019, 2:41pm UTC](https://forum.mattermost.com/t/solved-android-app-not-connecting/7704/4 "2019-07-23T14:41:44Z")

</div>

Hi @ghosttie,

Wondering if this earlier thread might help: [[solved] Mobile App(Android) TLS handshake error](https://forum.mattermost.com/t/solved-mobile-app-android-tls-handshake-error/7005).

These docs might also help:

- [https://docs.mattermost.com/deployment/ssl-client-certificate.html](https://docs.mattermost.com/deployment/ssl-client-certificate.html)
- [https://docs.mattermost.com/deployment/certificate-based-authentication.html](https://docs.mattermost.com/deployment/certificate-based-authentication.html)

---

<div class="post-metadata">

**Author:** ![amy.blais](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/amy.blais/32/7481_2.png) [@amy.blais](https://forum.mattermost.com/u/amy.blais)\
**Post date:** [July 23, 2019, 6:37pm UTC](https://forum.mattermost.com/t/solved-android-app-not-connecting/7704/5 "2019-07-23T18:37:48Z")

</div>

Hi @ghosttie, a response from a community member: Hard to say without more details (e.g. the app’s log output), but maybe something like this: [https://stackoverflow.com/a/11340510](https://stackoverflow.com/a/11340510).

---

<div class="post-metadata">

**Author:** ![ghosttie](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/ghosttie/32/3064_2.png) [@ghosttie](https://forum.mattermost.com/u/ghosttie)\
**Post date:** [July 23, 2019, 7:14pm UTC](https://forum.mattermost.com/t/solved-android-app-not-connecting/7704/6 "2019-07-23T19:14:46Z")

</div>

Thanks, the solution was to combine the server’s certificate with the intermediate certificate bundle from the provider.

It was confusing for a while because if you put the server’s certificate at the end of the intermediate certificate file then openssl says it’s valid but mattermost says the private key doesn’t match, but if you put the server’s certificate at the beginning of the intermediate certificate file then openssl says it isn’t valid but mattermost works.

---

<div class="post-metadata">

**Author:** ![yanuk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/yanuk/32/6348_2.png) [@yanuk](https://forum.mattermost.com/u/yanuk)\
**Post date:** [July 24, 2019, 3:46pm UTC](https://forum.mattermost.com/t/solved-android-app-not-connecting/7704/7 "2019-07-24T15:46:40Z")

</div>

hi @ghosttie ,  
can you share with a bit more detail on what you did?

I am facing this issue with some of my devices. My samsung Galaxy Note 8 running Android 9 connects but on my colleague’s Galaxy note 5 running Android 7 doesn’t connect. App requires minimum android 7. The last it connected on v1.21.0, v1.21.1 doesn’t connect.

Web browser from the phone connects but not the app.

I’m just checking if this can the be problem before starting another thread on connection issue.

---

<div class="post-metadata">

**Author:** ![ghosttie](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/ghosttie/32/3064_2.png) [@ghosttie](https://forum.mattermost.com/u/ghosttie)\
**Post date:** [July 24, 2019, 6:03pm UTC](https://forum.mattermost.com/t/solved-android-app-not-connecting/7704/8 "2019-07-24T18:03:09Z")

</div>

@yanuk it might not be the same problem because in your case it is working for some devices.

First of all to check if it’s the same problem, if you do `systemctl status mattermost.service` and see `tls: unknown certific` then it’s probably the same problem - apparently browsers automatically look up intermediate CAs (which is why it works in browsers) but other TLS clients may not, so you need to provide all of the certificates.

**Here’s what I did to fix it:**

From my SSL provider I received a .crt file which was the certificate for my server and a .ca-bundle file which had the certificates for the intermediate CAs in it.

If you look in those files you’ll see that they’re just text files so you can manipulate them with a text editor. Assuming you have a file with the intermediate CAs in it, you can see that it’s just a series of certificates one after another.

All I did was open the .crt file in a text editor and copy its contents, then open the bundle file in the text editor and paste the certificate at the top of the file. So the bundle file is still a series of certificates one after another, but with your server’s certificate as the first one.

If you don’t have an intermediate CA file from your provider you’ll need to figure out what intermediate CAs your certificate needs, get those certificates and put them in a file yourself (in the right order). Your SSL provider should provide this information to you, but some are more user friendly than others.

---

<div class="post-metadata">

**Author:** ![yanuk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/yanuk/32/6348_2.png) [@yanuk](https://forum.mattermost.com/u/yanuk)\
**Post date:** [July 25, 2019, 6:54am UTC](https://forum.mattermost.com/t/solved-android-app-not-connecting/7704/9 "2019-07-25T06:54:33Z")

</div>

got it. It didn’t solve my issue so I guess it’s a different issue.  
Thank you for the input! I hope it will help others. I shall start a new thread.

---

<div class="post-metadata">

**Author:** ![ghosttie](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/ghosttie/32/3064_2.png) [@ghosttie](https://forum.mattermost.com/u/ghosttie)\
**Post date:** [July 29, 2019, 11:39am UTC](https://forum.mattermost.com/t/solved-android-app-not-connecting/7704/11 "2019-07-29T11:39:59Z")

</div>

@alanrogger007 this doesn’t sound the same as my problem

---

<div class="post-metadata">

**Author:** ![gak](https://avatars.discourse-cdn.com/v4/letter/g/958977/32.png) [@gak](https://forum.mattermost.com/u/gak)\
**Post date:** [April 10, 2020, 9:21pm UTC](https://forum.mattermost.com/t/solved-android-app-not-connecting/7704/12 "2020-04-10T21:21:30Z")

</div>

@ghosttie thank you, it did the trick, now it’s working for me as well…THANK YOU VERY for your post

---

<div class="post-metadata">

**Author:** ![mvanhorn](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@mvanhorn](https://forum.mattermost.com/u/mvanhorn)\
**Post date:** [May 15, 2020, 4:20pm UTC](https://forum.mattermost.com/t/solved-android-app-not-connecting/7704/13 "2020-05-15T16:20:28Z")

</div>

> [@ghosttie](#):
>
> It was confusing for a while because if you put the server’s certificate at the end of the intermediate certificate file then openssl says it’s valid but mattermost says the private key doesn’t match, but if you put the server’s certificate at the beginning of the intermediate certificate file then openssl says it isn’t valid but mattermost works.

This is the key right here; the chain certificate has to be in the correct order. In my case, the server’s certificate came at the end of the file we got from InCommon. Once I finally found this post and changed the order, the key error went away, and it started working from the Android app!

_This_ should really be documented somewhere.

---

<div class="post-metadata">

**Author:** ![jmedley](https://avatars.discourse-cdn.com/v4/letter/j/f14d63/32.png) [@jmedley](https://forum.mattermost.com/u/jmedley)\
**Post date:** [September 17, 2021, 6:41pm UTC](https://forum.mattermost.com/t/solved-android-app-not-connecting/7704/14 "2021-09-17T18:41:20Z")

</div>

THANK YOU!!! I spent hours trying to get this working this morning. I had tried concatenating the files but I had my certificate under the ca-bundle.

Some search terms to maybe help folks find this in the future.  
certificate chain  
mattermost untrusted certificate  
android app  
android mattermost untrusted certificate  
TLS  
SSL
