I am doing research about some http libraries and I had to modify some of the libraries. Part of the research is to test it on closed source apps so I am wondering if there is a way to replace a library inside an APK app without having the source code of the app. For example some apps use Okhttp3 library as an http client. I did some modifications to the Okhttp3 by downloading its source code and compiling it as a jar file. Now I want to know if I can make the APK of a closed source app uses my modified version of Okhttp3 instead of the official okhttp3 that is included in the app's APK.
A tricky one. But I had done a similar task using APK studio.
APK studio decompiles the java classes into .smali
files.
You should first build an apk which uses your new library, then decompile it using APK studio. Copy the library folder and replace it in the original apk. After that with some luck, you will be able to build apk from APK studio.