Re: Python with Android

287 views
Skip to first unread message

Mark Mikofski

unread,
Apr 10, 2013, 5:02:39 PM4/10/13
to python-fo...@googlegroups.com
On Wednesday, April 10, 2013 5:14:27 AM UTC-7, Adil Ansar wrote:
I am just starting with android and have a good knowledge of python...
the problem is that I dont know from where to start...
I have downloaded the android sdk and installed the android emulator but I am looking for some basic tutorials (video tutorials preferred) also I want to know how to convert a .py script to .apk (android application)...
Sorry if this is a very basic question but I dont know how to start...
Thanks everyone in advance..

You might try kivy [1], the other python-for-android [2], KDE necessitas SDK [12] and android-python27 [3].

Basically your options are to use:
(a) Java and the Android SDK,
(b) script on your phone using SL4A and PY4A
(c) embed Python into apk's using Android NDK

If (a) then you use Java not Python.

If (b) you don't need the Android SDK, just download and install SL4A-r6 [4] and PY4A-r5 [5] - you must have install from unknown sources checked in your phones settings. You do **not** need root to use SL4A/PY4A. Then to make apps, use the SL4A API [6]. If you are making gui's then the fullscreenwrapper2 [7] module may be very useful to you. There are a few limitations to using SL4A, and it has not seen development in about 9 months, but you can still do a lot with it.

If (c) then you need the Android NDK [8], and then take a look at Kivy, python-for-android and android-python27 as starters. Or search google for "python for android" and you will see many historical hits. android-python27 has Qt library bindings, so you will need to install necessitas Ministro [9]. You might also look at KDE's necessitas site [10]. Basically you will be building your apk in C/C++ so that you can bundle in libraries not included in the Android SDK that are not in Java, e.g. libpython and all of the libraries that Python requires.

This thread [11] also presents several methods, including some already mentioned here. Keep searching through the archives on google groups for PY4A and SL4A because I remember seeing several posts on this topic.

Adil Ansar

unread,
Apr 11, 2013, 10:13:22 PM4/11/13
to python-fo...@googlegroups.com
thanks @Mark kivy worked for me...I just created a working .py script and coverted it to .apk and app run succesfully and all it seemed so easy after ur post thanks a lot...
In my college 90% of the student have no interest in python and they all are working on eclipse IDE...
I like working with python..
Is it like this-> that kivy is not much famous....or it was me who was not able to look for it properly?

Joris de Ruiter

unread,
Nov 15, 2014, 6:25:59 PM11/15/14
to python-fo...@googlegroups.com
Thanks for that post, its a good update on the options. 

I am building an application in android Java which has to call Python code, which has to call C++ libraries in numpy. 

How would this best be achieved? Through NDK? 

Joris

Mark Mikofski

unread,
Nov 17, 2014, 1:27:00 PM11/17/14
to python-fo...@googlegroups.com
If you are in a java environment, then you could use Jython (http://www.jython.org/) and then try the ctypes module (http://www.jython.org/docs/library/cpython_only/ctypes-R.html). The stable package is an implementation of Python-2.5, but there is a beta implementation of Python-2.7.

--
You received this message because you are subscribed to a topic in the Google Groups "Py4A" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python-for-android/3sPwQLOF61I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python-for-andr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Being deeply loved by someone gives you strength;
loving someone deeply gives you courage.
Lao Tzu

Joris de Ruiter

unread,
Nov 17, 2014, 1:58:01 PM11/17/14
to python-fo...@googlegroups.com
Thank you Mark!
Reply all
Reply to author
Forward
0 new messages