I am running Android Studio 2.2.3
I need to run Python scripts during my development to process some data files. The final apk
does not need to run Python in the device.
At the moment I run the scripts from a terminal or from PyDev for Eclipse, but I was looking for a way of doing it from Android Studio.
There seems to be a way to do this, as when I right-click on a .py
file and select the 'Run' option, an 'Edit configuration' dialog opens where I can configure several options. The problem is that I cannot specify the Python interpreter, having to select it from a combo box of already configured Python SDKs. While there is no interpreter selected, there is an error message stating "Error: Please select a module with a valid Python SDK".
I managed to create Java modules for my project, but not Python ones (I do have the Python Community Edition plugin installed).Does anybody know how to achieve this?.
TIA.
Chaquopy is a plugin for Android Studio's Gradle-based build system. Chaquopy enables you to freely intermix Java and Python in your app, using whichever language is best for your needs: With the Python API , you can write an app partly or entirely in Python.
You can use SL4A project which would allow you run your Python code on Android. Show activity on this post. Check out Qpython, could be an easy solution. You can run your python script against the Qpython android python core, or deploy yours.
If you want to run any Python script in Background in Windows operating System then all you are required to do is to rename the extension of your existing Python script that you want to run in background to '. pyw'.
python-for-android is an open source build tool to let you package Python code into standalone android APKs. These can be passed around, installed, or uploaded to marketplaces such as the Play Store just like any other Android app.
If you only need to run the scripts and not to edit them, the easiest way to do so is to configure an external tool through Settings | Tools | External Tools. This doesn't require the Python plugin or any Python-specific configuration; you can simply specify the command line to execute. External tools appear as items in the Tools menu, and you can also assign keyboard shortcuts to them using Settings | Keymap.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With