java – Running python scripts (multi-module application) on android


I have a complicated Python script (not just a py file) that I would like to embed in my Android java application. I don't want to rewrite Python scripts in Java as they have a lot of plugins with good community and do exactly what I need. I am looking for a way to embed them in my Android Java app. The best I found is caquopy sdk (https://chaquo.com/chaquopy/) and it does exactly what I need, but they have a complicated and very hostile licensing process for the developer, so it is almost impossible to use them (I don't want spend a couple of months and then found out that I couldn't get a license from them.) Therefore I am looking for a more developer friendly solution. I consider the following options:

  1. fully service in python. use aidl or broadcast to communicate with the activity. If there is an example, it will help a lot.
  2. wrap python in a lib and do a java service on top
  3. pre-build Python code as native lib and use jni

I think # 1 I can do with kivy. but i couldn't find any example for such solution: i don't want to use kivy for the activity.

I will appreciate any ideas.