Implementing Python functionality in Android application

I have created one project which has machine learning and Signal processing functionality.

This project is running on server without any issue. My android device making API call to server and getting response.

I want this functionality to be run offline (Without Internet) without calling to remote API.

What are the possible way to run to Python functionality in the Android application?

Writing entire application in Java is not feasible because it depends on many python libraries like numpy, scipy, pandas, sklearn etc.

3 answers

  • answered 2019-11-08 13:52 Abdelhak Bougouffa

    Maybe you can use Termux which is an Android terminal emulator and Linux environment app.

    It comes with a package manager pkg which can be used to install Python.

    pkg install python # or python2
    

    It installs python and the pip package manager.

    You can also find some useful information in wiki.python.org/moin/Android.

  • answered 2019-11-08 14:11 Dmitry Yablokov

    It is possible to use python for android project https://github.com/kivy/python-for-android. For rooted device or system app it is possible to launch python interpreter (compiled binaries) as a separate process with script as a parameter

  • answered 2019-11-08 14:13 max_sargent

    You can try Chaquopy, it allows intermixing of Python, Java and Kotlin. Furthermore it allows the use of cheeseshop (PyPi) packages such as the one you described.

    You should be able to integrate your existing code with a Java application for Android.

    https://chaquo.com/chaquopy/

    It requires a commercial license if you don't want to opensource your code.