Skip to content

Troubleshooting Procedure

Alex Gotev edited this page Oct 17, 2020 · 22 revisions

You know, these days when something doesn't work, the first thought of many people is the app is bugged, so you're engaged to provide some insights and analysis. Since you are using a third party library, you may be tempted to think

followed the examples, run my app, it doesn't work, so its' it's a library bug for sure

wrong, but don't worry and keep reading. This will help you spot where the real issue is step by step, methodically, like we engineers do 🍷.

If you find this helpful, consider sponsoring the project by pressing the Sponsor button on the top right of this page.

Let's face it, doing network programming is not easy as there are many things that can go wrong, but if upload doesn't work out of the box:

Upload works with curl/postman + your server Upload works on your app + your server Solution
πŸ”΄ πŸ”΄ Check your internet connectivity to the server and your server. Fix eventual issues and then retry.
🟒 πŸ”΄ Check your app for bugs, be sure to have followed the examples. If still in trouble, read the next paragraph
🟒 🟒 All right, let's have some fun!

When making tests, be sure to make the exact same upload when using curl/postman and your app. For example, if you upload a 200MB file from your app, be sure to upload the same amount of data or the same file using curl or postman and to send the same parameters and headers

So, you can make an upload from curl or postman, but not from your app

  • Is the server URL correct?

    • NO: That may be the issue
    • YES: Go to the next question
  • Is the server URL reachable from your device?

    • NO: Check if there are firewalls or other kind of restrictions between your device and the server.
    • YES: Go to the next question.
  • Have you properly set up the request with all the headers, parameters and files that the server expects?

    • NO: That may be the issue
    • YES: Go to the next question
  • Is your server using HTTPS?

    • NO: Be sure to have cleartext requests enabled for your app, otherwise Android may block you.
    • YES: Be sure to have valid and trusted certificates on your server. You can easily check by visiting your server address from Google Chrome or Mozilla Firefox. If a security message pops up, then something is wrong with your certificates. Fix that. If you just want to ignore that exception while you are testing in your own environment, go in the advanced topics of the wiki and see how to enable self-signed certificates.
  • Are you sure you are starting the upload from your app? Can you see the library debug logs?

    • NO: Enable library debug logs. 4.x versions have them enabled by default for debug builds.
    • YES: go ahead to the next paragraph

Checked all the above and still no luck. Upload works from curl/postman but not my app

It's time to setup the Upload Service testbed. Follow those instructions: https://github.com/gotev/android-upload-service/wiki/Upload-Service-Testbed, then get back to this page. Can't make the testbed work as described? Report all the details in an issue.

Upload works on demo app on emulator + demo server Upload works on demo app on your device + demo server Upload works on your app + demo server Upload works on your app + your server Solution
🟒 πŸ”΄ -- -- Check your device and your network. Ensure it's on the same WiFi network as your computer and there's no client isolation between the two
🟒 🟒 πŸ”΄ -- Check your app for bugs and eventually change the demo server's responses to match what your app expects. If still no luck, create an empty project wthout your business specific stuff and keep things to minimal while trying to replicate the same behavior. If you can replicate the same problem, open an issue with all the details and the demo project
🟒 🟒 🟒 πŸ”΄ The problem is in the network between you and the server or in the server itself.
🟒 🟒 🟒 🟒 All right, let's have some fun!

Other useful info

Dump network traffic

If something is not working as expected when you perform an upload and you can't figure out where the problem really is, dump the network traffic and analyze requests and responses with Wireshark. An useful free tool to dump the network traffic directly on your device is tPacketCapture. It creates a .pcap file in /sdcard/Android/data/jp.co.taosoftware.android.packetcapture/files/ ready to be transferred to your computer (you can use Dukto for that), which you can open with Wireshark. Top 10 reasons to learn Wireshark.

Android 6.0 Permissions

Permissions needed by the library are listed in the manifest. As stated here, only android.permission.WRITE_EXTERNAL_STORAGE is considered dangerous, so you have to make sure that your apps has that permission granted. It's needed to be able to select files for upload and delete successfully uploaded files.

SSLHandshakeException on Android 4 (Android API < 21)

If your server uses modern certificates which support TLS 1.2, you may have problems on older Android devices. This is due to the fact that TLS 1.2 is not enabled by default on those devices even if it's implemented, so you may have SSLHandshakeException. Check this issue to solve this problem. Bear in mind the solution may not work on all devices, as hardwares which runs Android prior to 5.0 may not have the capabilities required by TLS 1.2.

Clone this wiki locally