I am trying to setup my own Server to host apk files which will be available for installs and updates in the client App.
On new version update of apk, only the updated part should get downloaded at the client end. I am able to generate a patch file using "bsdiff" at the server end. But at the client, how should I merge the patch file with the original apk and install the update.
Based on your question, it looks like you are looking for some kind of patching system. Normally Google play store takes of managing this. When you upload a new version of APK, it only download the difference on client's device which saves data for customers. However the merging of this done on Mobile itself.
Since you are not using google play store, the only way available could be a patching system like AndFix. Some more options can be found on this SO. Most of them require some code changes.
You can also follow the concept of expansion files described by Google. You should be able to mimic the approach.
Note: Google play policy discourages this approaches if you are distributing it though Google play store and not utilizing Google Play's update mechanism. You need to be careful in case you are planning to distribute your app through play store in later stages
来源:https://stackoverflow.com/questions/42091006/delta-update-for-android-app-updates