Python on Android - Android Q&A, Help & Troubleshooting

Has python been ported to Android ? I would love to run some Python 3.x scripts on my Android phone.
I searched the forums and this was last asked 2 years ago..
The python app here under Android Scripting, does'nt appear to be currently maintained.
http://code.google.com/p/android-scripting/downloads/list
The best I found was here however the Android api for Python appears limited at present.
https://github.com/kivy/python-for-android

dazdaz said:
Has python been ported to Android ? I would love to run some Python 3.x scripts on my Android phone.
I searched the forums and this was last asked 2 years ago..
The python app here under Android Scripting, does'nt appear to be currently maintained.
http://code.google.com/p/android-scripting/downloads/list
The best I found was here however the Android api for Python appears limited at present.
https://github.com/kivy/python-for-android
Click to expand...
Click to collapse
check out these two links. you need android scripting then install the python plugin
hope this helps. i've been using this for python scripts and you can use function from the phone like camera and stuff
http://code.google.com/p/android-scripting/
http://code.google.com/p/android-scripting/downloads/detail?name=PythonForAndroid_r4.apk

Please use the Q&A Forum for questions &
Read the Forum Rules Ref Posting
Moving to Q&A

SL4A
You want Scripting Layer for Android. Once you've installed that, you can install Python, and other languages, from within the app. I think for Python, there's only Python2.6 at the moment, but it works very well, and your scripts will be able to import a module called android, which offers a pretty comprehensive Android API.
It's trivial to set up and you don't need root. I'd provide a link, but I only just signed up for XDA, so I'm not allowed yet. Just search for SL4A.

Related

Cross compiling for the Nexus One on Linux

Hey All,
I'm curious about compiling a native Linux app for the Nexus One, and wondering what the best way is to go about it in Ubuntu. I found this link for the G1:
http://android-dls.com/wiki/index.php?title=Compiling_for_Android
Since the Snapdragon is also ARM I'm assuming this will work, but is there a decent way to do this on Ubuntu or is my best bet to install Debian in Virtualbox and compile it there?
Thanks,
-Dan
overridex said:
Hey All,
I'm curious about compiling a native Linux app for the Nexus One, and wondering what the best way is to go about it in Ubuntu. I found this link for the G1:
http://android-dls.com/wiki/index.php?title=Compiling_for_Android
Since the Snapdragon is also ARM I'm assuming this will work, but is there a decent way to do this on Ubuntu or is my best bet to install Debian in Virtualbox and compile it there?
Thanks,
-Dan
Click to expand...
Click to collapse
There's a certain amount of vagueness associated with your generalized request.
That said ... ubuntu is sooo very very closely related to debian in the linux fam!
Almost all things described in the link your reference will carry-over/hold-true in ubuntu as they are stated in debian.
But ... the real kicker is the specific app you're trying to compile.
Depending on what the app you want to build depends on ... will determine your overall success. While the reference posted link is insightful, you must understand the need to link against libraries being used. Many of these libraries (at least the basic 'c' ones) you'll find in the AOSP code in android's git repo.
I would suggest taking a look at the "external" projects found in the AOSP code to see how they utilize the makefile setup and build-environment and how they leverage bionic and others to build against.
The way those projects build out, would be essentially what you're looking for .. (I assume) again, I state this without knowing the specific app you have in mind.
Hope that helps.
~enom~
How well would a linux disto made for desktop PCs work with touch screen mouse inputs and no keboard support? (im assuming the Android VK doesnt work when you press on a textbox in a Linux Emulator)
enomther said:
There's a certain amount of vagueness associated with your generalized request.
Click to expand...
Click to collapse
Sorry, I should have been more specific - by Linux native I didn't mean any app in particular, I just meant not a java Android app. I'm really just looking to compile a HelloWorld in C and run it at the shell on the Nexus at this point.
My main concern with the link I posted is that although Ubuntu is based on Debian, Ubuntu does not maintain an ARM version, and the package mentioned in that tutorial is not included in Ubuntu because of this.
So I'm just wondering if anyone has come up with a good solution for compiling for the Nexus in Ubuntu, or if I'm better off installing Debian in a virtual machine.
Thanks,
-Dan
http://android-tricks.blogspot.com/2009/02/hello-world-c-program-on-using-android.html
I think this is more of what I was looking for, I'll build AOSP and try out the agcc script.
-Dan
Another idea: find the Android source wherever Google hides it, I have forgotten, sorry! But they give instructions for setting up a whole ARM cross-compiling environment on x86/x64 Ubuntu, and as I recall, it was really easy, quick and automatic! (so easy, I did it just so I could compile some ARM apps myself, I really didn't need to compile Android, I don't build phones! )
After that, you too should be able to compile your own apps into native ARM binaries.
overridex said:
Sorry, I should have been more specific - by Linux native I didn't mean any app in particular, I just meant not a java Android app. I'm really just looking to compile a HelloWorld in C and run it at the shell on the Nexus at this point.
Click to expand...
Click to collapse
To do this, you need a version of the ARM tools appropriate for your platform and then use them for building a static binary for Linux. You can find such tools at CodeSourcery (http://www.codesourcery.com/sgpp/lite/arm). Given that you sound like you have Ubuntu, then the Linux version from this page, http://www.codesourcery.com/sgpp/lite/arm/portal/[email protected]=lite, would be what you want. The key is to use the --static parm when you build the binary.
From there, just get your binary over onto the target and run it from the command shell.
Remember that static binaries are HUGE. They have to include all library functions linked in.
If you are looking for tiny binaries, look into the NDK and use the BUILD_EXECUTABLE rule for Android.mk.
A few more useful links, but not much that hasn't already been stated in previously referenced links:
http://benno.id.au/blog/2007/11/13/android-native-apps
http://honeypod.blogspot.com/2007/12/dynamically-linked-hello-world-for.html
http://honeypod.blogspot.com/2007/12/initialize-libc-for-android.html

[Q] android platform development with other languages

is it possible to develop android platform (ROM) with C, C++ ?
as i read some where that for performance related coding are done in C, C++
and Google has selected java for development over c, C++ ?
is java is better than C, C++?
Hi swapk007,
it is possible to write in other languages too.
Problem with C/C++ is that those are native languages i.e. they are compiled to platform dependent code. So google choose dalvik a java based virtual machine to alow
development in a "compile once run everywhere" style to reach all the platforms for all those many android phone vendors wich use
differing processors.
Iphone has just one hardware so i think there its easy to use C. I think they use ObjectiveC there.
If you develop in c/c++ for android you have to crosscompile for an android with different processor.
There are script enviorments though wich will give u portability wich can be found on the market (sl4a for example).
To develop in c/c++ have a look here.
http://developer.android.com/videos/index.html#v=Oq05KqjXTvs
Here are some news about google activley supporting c++ on android.
http://www.xing.com/net/moderncpp/news-111939/google-android-nun-auch-mit-c-unterstutzung-22341437/
and
http://arstechnica.com/open-source/news/2009/06/android-goes-beyond-java-gains-native-cc-dev-kit.ars
Hope that helps you , if so please thank me in the forum.
Sent from my GT-I8150 using XDA App
thanx polifemo..
so that means i can develop android rom with NDK?
Maybe i don't get you right on this.
What do you mean by developing android rom ?
If you want to make ur custom rom which means taking android sources and build android from it,
it includes building linux kernel (wich is asm+c) , core system ( mainly c) dalvik engine (which is c++ i think) and dalvik runtime which is dalvik-java and jni-system libs glue stuff. There are frameworks for building all this and throw out ready to install roms called kitchens. Search this forum for those and tutoirial for your target device.
If you want to make a proggi in another language than java which runs on android look at my first reply .
So long ...
Sent from my GT-I8150 using XDA App
Here is a link to dsixda's kitchen thread.
http://forum.xda-developers.com/showthread.php?t=633246
Sent from my GT-I8150 using XDA App
Please use the Q&A Forum for questions &
Read the Forum Rules Ref Posting
Moving to Q&A

[Q] help me making an android app.

hello,
I am a student currently studying java programming
i have a java code that implements a program that i made using eclipse, and what i want to know is how to turn it into an android app. ?
the program takes a string input and returns another string using one main methods and many other methods they all process strings.
i have the android sdk and eclipse plugins but i have no idea where to put the code and how to sit the UI.
thanks.
i am sorry if my question is in the wrong place please tell me where should i post my question.
peace
You'll need basic knowledge about Android Development, search for tutorials, there are many of them, like this (I think that tutorial is all you need).
To can compile the code shown, basically you need:
Android SDK and ADT Plugin for Eclipse.
Open SDK Manager, located where you installed Android SDK. Download the packets of the platform which you desire as target (Android 2.2 or 2.3 is recomended, in order to achieve a high compatibility. Remember: Android is retrocompatible).
Now, you can start an Android project from Eclipse and compile that code. The Java methods that you already developed, should works fine on Android, don't worry about that
If you need more help, feel free to send me a MP, or post your question here. I'm not a developer, but I can understand the necessary things to achieve a basic Android app

Questions About Developing

Hello Everyone I Am New In This World And I Have Some Questions About Developing
-Which Programming language Should I Learn To Create Apps.?
-How To Create ROM?
-What About Porting Something From A Device To Another One?
-Is The SDK Of The Mobile Is Enough To Port Something From It?
-Should I Own An Old Phone For Testing?
P.S. I Have GS3
You develop for Android primary in the Java language. You may write native (i.e. compiled) code as well, but Java is recommended in most cases.
Creating custom roms is much like creating a Frankenstein Monster. Decompose your original rom, pick the pieces you like, replace the other with stuff you dig up from other places, or create yourself. Then re-pack everything in your new custom image, flashing you phone. The details about what to use to split images, flash devices etc you have to search this forum for - it'll differ from device to device.
When developing for Android you chose a minimal API level, e.g. Android 1.5. This way your app will run on all devices with at least Android version 1.5, no porting needed. Java is "write once, run many" so to say.
You can test your new apps either on you phone or in the emulator (Android Virtual Device) supplied with the SDK. If you intend to develop lots of code, a dedicated phone may be quite useful for testing, yes, but absolutely not necessary. You'll not crash your phone just because your application crashes, all apps are running in separate processes protected from each others.
You find the official tutorial at developer.android.com/training/basics/firstapp/index.html
Thanks For Your Help. Your Words Are Very Useful
THE.W!ZARD said:
Hello Everyone I Am New In This World And I Have Some Questions About Developing
-Which Programming language Should I Learn To Create Apps.?
-How To Create ROM?
-What About Porting Something From A Device To Another One?
-Is The SDK Of The Mobile Is Enough To Port Something From It?
-Should I Own An Old Phone For Testing?
P.S. I Have GS3
Click to expand...
Click to collapse
you need java to learn programming................
for basic rom making a bit of general knowledge is enought not much of programming is required........
for basic porting you can use cygwin for complex ports u need t change the framwork files which you will learn as the time passes..
sdk is required for building app and adb fastboot not for porting and other kind of stuff(related to api's)............
what do you mean by old phone.. you build mods for your phone so test it on the phone you built the mod for not old phone or something like that.........
The first thing you need to do is learn Java.
http://forum.xda-developers.com/forumdisplay.php?f=613

[Q] Eclipse Setup and Android Development Workflow

Hi.
I'm a java developer who wants to start to develop and learn cyanongenMod and AOSP. Start by saying that I have a good knowledge of Java and Android development but little knowledge of programming and debugging in C / C ++
I have readed all the documents from AOSP sites and following the guide found on source.android.com.I was able to setup Eclipse for all the Java applications
Pros: I can study the whole Java nature of Android and Cyanogenmod, using eclipse as a "code browser"
Cons; unable to edit the layout.xml (for example) and unable to use the Android feature of an eclipse project
It could be nice for Java developing, but for the others projects and OS parts there isn't a "IDE setup guide". I am a little bit confused about how the general development workflow goes. The build procedures for every device found at CM wiki are great but...after that?
How to develop, modify and debug a single Java Application on a real device?
How to develop, modify and debug a c/c++ driver or patch for a real device?
If I want to work only on a single Java application, I can't import it in Eclipse. If I want to debug on a real device (for example, the photosphere feature in Samsung Galaxy Tab 10.1 does not work), I can't setup a debug environment.
Where I can find a good guide-site-tutorial ?
I use this link whenever I get a new computer etc. This not only explains what to do but has all the download links and more. Good luck!
http://www.makeuseof.com/tag/write-google-android-application/
Sent from my Nexus 4 using xda premium
mellowdev said:
I use this link whenever I get a new computer etc. This not only explains what to do but has all the download links and more. Good luck!
Click to expand...
Click to collapse
My question is not about developing android application, but about developing android operating system. I find a lot of articles on makeuseof.org about installing cyanogenmod, for example. But no articles about developing cyanogenmod
sarbyn said:
My question is not about developing android application, but about developing android operating system. I find a lot of articles on makeuseof.org about installing cyanogenmod, for example. But no articles about developing cyanogenmod
Click to expand...
Click to collapse
Sorry but I think that is impossible that no CyanogenMod dev reads XDA forum.
If a noob want to find guide and tutorial and start develop for AOSP o CyanogenMod, where he can ask for help?
Ask from a dev in free xperia project. They develop cyanogenmod

Categories

Resources