I have a python script to do some task and I want to execute that script and send some arguments to it from my Android App which is developed in Kotlin.
So my question is how to do it?
ie. how can execute the python script and read its output in my Android App.
Thanks in Advance.
Basically, you can’t since Android does not have a python interpreter. Jython does not work with Android (and it is overkill anyway), so your only option is to compile your python code to native executable and use NDK to invoke it. But I would recommend to just rewrite your script in kotlin. It is much easier.
The python script that I want to run uses OpenCV library, Is there any equivalent library in kotlin?
According to its site, OpenCV has direct Java bindings so you can call it from kotlin via those bindings. But you have much larger problem. Since it is written in C++, you can’t take it with you to Android as is whether you have bindings or not, you have to use NDK for that. You should search around Android community for a solution. It is not kotlin problem. If you will find some java bindings, then you can just call java functions from kotlin.