Is there a way to call python code in android for development without installing sl4a?

I found several ways to use python to build an Android app. But they all need to install sl4a and pythonforandroid. It's so complicated, is there any way to package sl4a in my Android application project, and as soon as I install apk, I no longer need to install sl4a.

+5
source share
2 answers

You can use Kivy at the following link:

Python for Android

This will help you take a look at the following section:

How can I integrate Python code into an Android Java application?

Hope this helps you.

+3
source

Can you do this. It is about packing the Python interpreter (compiled NDK) into your application and running it using standard NDK mechanisms. This is the same as, for example, Kivy does, but you add code to your application, and not (for example, Kivy) using a java bootstrap, and then let Python control everything else.

One option that was recently discussed / developed is to use python-for-android to build all the python components, then copy them into a java project (and add code to process it). It is possible, but at the present time is not as simple as it could be, you will need to study how it works inside to get the results you need.

Another option, which is probably now easier if you don't need compiled code outside of python itself, is to directly use the pre-compiled CrystaX NDK python binaries , in which case, including python binaries, comes down to adding them to your Android .mk. You still need C and NDK code to interact with the interpreter, but the process is quite simple.

(SL4A has its own tools for creating Android, which you can also use for this, but I do not know what you need to do to integrate it, since I think that SL4A does additional things on top of that, there is a python interpreter).

+1
source

All Articles