-
-
Notifications
You must be signed in to change notification settings - Fork 697
Troubleshooting Procedure
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:
-
make sure you have followed the steps described in the wiki, in which you can find how to setup everything and make it work
-
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?
-
YES
: Go to the next question. -
NO
: Check if there are firewalls or other kind of restrictions between your device and the server.
-
-
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
-
-
Can you successfully make the same identical upload to your server URL with a browser or some other tool like curl or postman?
-
NO
: check your server. -
YES
: enable library debug logging and check the code you used to create the request. A dump with wireshark is useful in those cases, to discover what is the difference between the working request made with curl or postman and the request made by your app.
-
-
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 that the server side is working properly?
- For example, if you use PHP in your server side, and you get an EPIPE exception, check if the content size you are trying to upload exceeds the values of
upload_max_filesize
orpost_max_size
set in yourphp.ini
- For example, if you use PHP in your server side, and you get an EPIPE exception, check if the content size you are trying to upload exceeds the values of
-
Have you tried uploading a file with the testbed?
-
NO
. Try it. -
YES
. Then:
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 🔴 -- -- 🟢 Testbed setup problem. Check the instructions again and if it doesn't work, open an issue with all the details. 🔴 -- -- 🔴 Testbed setup problem + your server failing or
library problem. Check if you can perform an upload with some other tool against your server. Ifyes
, open an issue with all the details. Ifno
, go fix your server first and then retry once it's fixed🟢 🔴 -- -- 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 response format to match what the app expects 🟢 🟢 🟢 🔴 The problem resides in your server or the network and infrastructure between you and your server -
-
search in the issues. Your question may have already been answered.
Android Upload Service Demo app has Facebook Stetho integrated. This means that to track what happens on the network, you have to do the following:
- deploy the upload service demo app to a virtual device or your physical device connected to your LAN,
- launch Google Chrome, navigate to
chrome://inspect
- click on
inspect
, then switch to theNetwork
tab
Now you can see all the requests and responses directly with Chrome Developer Tools! If you integrate Facebook Stetho in your app, you can do the same! Pretty cool, huh?
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.
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.
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.