Can Linux apps be run in Android? - android

Android is based on Linux; can native Linux applications be run on Android?

In general, no. Android apps generally run in a sandboxed Java-like virtual machine, so have to be written in Java or some language that compiles to virtual-machine bytecode that use the Android API.
However, the virtual machine does run on top of the underlying Linux OS, and there are ways to call native code. See https://developer.android.com/tools/sdk/ndk/index.html
So, while it is technically possible to run native Linux programs, as there is a Linux kernel running beneath everything, most users would not be able to install such applications or use them. (If you have root access or are building your own firmware, then you can do whatever you want.)

Yes you can. I have installed a complete Debian distribution in a chroot-jail enviroment using debootstrap. (You need a rooted device)
I am now running ssh, apache, mysql, php and even a samba server under android on my htc-desire with no problems.
It is possible to run x applications using a remote x server via ssh. It even runs openoffice.org and firefox.
You can use this: http://code.google.com/p/android-xserver/ to run X-application on localhost but my HTC-desire has a to small screen to be productive :-) But it might be usefull on a Eee Pad Transformer or something like that.

Android does not run X Windows, nor does it have many of the standard GNU libraries. So, since most native linux applications require one or both of these, most will not run.
In addition, even Java programs can be limited, because the version of Java that Android applications are written in is a subset of the standard Java library.

Not directly, no. Android's C runtime library, bionic, is not binary compatible with the GNU libc, which most Linux distributions use.
You can always try to recompile your binaries for Android and pray.

yes you can ;-)
the simplest way is using this ->http://www.androidfanatic.com/community-forums.html?func=view&catid=9&id=2248
The old link is dead it was for a Debian install script There is an app for that in the android market
but you will need root

android only use linux kernel, that means the GNU tool chain like gcc as are not implemented in android, so if you want run a linux app in android, you need recompile it with google's tool chain( NDK ).

You can get an ARM cross compiler that runs on Linux here.
You can also download the Android NDK and compile some command line apps.
I do not have any personal experience with using C++ with either solution, but I have compiled a few simple things with both. It is my understanding that the NDK is not a full C++ compiler as there have been complaints that it will not compile some common C++ code.
Note that since I am a new user, I cannot post the NDK link... :/

I think this article can provide a solution : Linux Today - Compile, Install and Run Linux apps on Android
Hope it helps.

yes i have done that on several rooted machines
i set a debian linux on a sdcard by dd.
i copy this script http://jeanmichel.gens.free.fr/etc/install on /system/bin
i have not yet succeed to run a Xserver but i can use xwindows binaries through the android Xserver application
i can run update my debian with apt-get upgrade , run an apache server with PHP , run a ssh server
and all binaries on a terminal including user management
i have also a problem with semaphores handling
please contact me if you have any trouble

Yes they can if they're compiled under an arm linux first or using a cross compiler. Debian arm versatile works, there's also arm-eabi for compiling under x86 linux to arm linux.

Yes, they can. If you do not have a rooted phone/tablet, then you could download c4droid here to compile your apps. Then, you could download Kevin Boone's KBOX here to run the program.

Hell, of course yes, with several limitations.
Android is a kinda special Linux distribution, with no usual suff like X11, and you can't install Apache2 with apt-get. But if you have ARM cross-compiler, you can copy your ELF files to the device, and run it from a terminal app or if you have installed some SSHD app, you can even use SSH from your desktop/notebook to access the Android device.
To copy and launch a native Linux executable, you have not root your device. That's the point, where I am, I've compiled my own tiny webserver to Android (and also for webOS), it runs, hallelujah.
There comes the issues, which I can't answer:
My tiny webserver use only stdlib and pthreads. I have no idea how to use the (native Linux) libraries comes with Android, there are useful ones, altough, I can live without them.
Now I can launch my app from a terminal app by hand. But I don't know, what's the best way of deploying such native apps to Android. I think I should be write a small Android app, which launches the server and not letting automatically stopped by the system (say, as like music players never killed). Also, if its a service, it should somehow started on boot. I'm not familiar with Android.

Short answer, no.
Long answer, you can run Linux application if you install some software.
To avoid rooting your device, you can try the GnuRoot and XSDL combo to get a minimal chrooted environment, (Actually, it use proot to enable a rootless chrooted jail), or get the Debian Noroot application, which combine the former two application in a single virtual machine environment.
Both can be fetch from Google Play.
However, there is a few drawbacks: first, the X11 Server bundled by XSDL and DNR is a compatibility layer wrapped around a Android port of SDL library and SurfaceFlinger.
This means, hardware accelerated OpenGL graphics are not avaliable, and even the sound support requires some hacks. So, the author choose a simple Desktop Environment: XFCE4 suitable to low memmory and no 3D support.
The second problem is the incompatibility from the DNR Virtual Machine of direct hardware acess, since it requires real root privileges. So you can't burn DVD, print using USB cables,... even the author's projects may promise a workaround in a future.
Finally, this solution enables to install user-space programs like LibreOffice, Gimp, Samba,... not kernel-space modules.
Even with this limitations, the DNR is a very powerfull program.

You can install chrooted linux distribution alongside android bacause android is based on linux kernel. If your phone is not rooted, you may use fakeroot (easiest way is to use Debinan nonroot app) even with GUI (with android X-server app or via VNC). If you have a rooted phone, you can install almost fully functional distribution.
I think the best performance and the least limitations you can achieve with Gentoo because all software compiles to your native arm architecture and it is the most flexible, but not the easiest. You may be interested in this post about installing Gentoo on android.

It depends on what you mean by "Linux applications", and what you hope to achieve.
First, if you mean, can you copy an x86-64 Linux binary executable to an Android device running on an ARMv7 processor, and run it... well no, that won't work at all, for several reasons.
If you mean, can you run Linux programs within a Linux emulator running within Android, sure... with limitations. Have a look at "Termux". With that, you can run many command-line applications. With a VNC server running in Termux, you can run some Linux X GUI applications, and use them in a VNC client (See the Termux Wiki). There is also "Termux:GUI" --- I've never tried it.
If you mean, is it possible to compile applications meant to run under Linux, so that they can run as native Android apps, well, that depends.
Up to Android 4, you could cross-compile a C "Hello World" for ARMv7 under Linux, adb push it over to an Android phone, and run it in an Android terminal emulator. I have done it. But the security model of more recent Android systems makes that much trickier: there is no way to give such a file Linux executable permissions. (chmod 777 does not function.) On a rooted device, such things are still possible.
I suspect that it is possible to install native ARMv7 binaries (even without the NDK --- say, just a "Hello World", which doesn't require all that), along with an Android app installation, so that it is executed from the app. It's only a matter of permissions. I haven't yet figured out how.
But a "Hello World" isn't really a Linux application. A Linux application would make use of the Linux system and libraries. And even on a rooted device, what remains of Linux in Android is terribly limited and altered. You would have to build up the necessary software infrastructure to run a more elaborate application. And that might be an impractical task.
But if you're going to do that... wouldn't it be better to just root the device, and install Linux on it? That can be done, too. Sometimes.

these are all total lies above
Android x86 pie uses linux kernel 4.19 with most PC kernel modules DISABLED (you have to rebuild the kernel yourself for PC hardware - for VM maybe not)
Android installs unix (GNU+freebsd+ubuntu parts google threw together) in, was it, /system/bins
there seems to be some heavy lying going on by ubuntu, rh even android about whether Android has a linux OS
it most certainly does: and, the Java is Sun/Oracle java, and it is intalled as a linux version, and requires a linux OS to load it
You cannot build an app for phones, say it is "for Android" that doesn't sandbox and breaks Android: it's against policy and they will come after you and remove your app off the store for good reasons. HOWEVER: you can do it at home on your personal android if you can afford to be an unpaid developer :)

Related

Running Android apps on a Linux platform

We're developing a Client-server system for Android apps, in which the server should be a Linux machine.
Of course we're using VMs, but that's only as good as a real mobile device. Since we're looking at improving speed, we'd like to run those apps on a Linux machine.
Can any member give a broad idea on how to run Android apps on a Linux platform ?
You need to use dex2jar to convert an APK file to a JAR and then you need IcedRobot to run the Android stack above OpenJDK. Maybe I will try to emulate AndroidGL with JOGL 2.0 (it supports both OpenGL and OpenGL-ES). Keep in mind that it is not trivial.
The emulator of Android SDK is quite slow but you just have to enter adb install my_file.apk to install your application.
You can run android-x86 in VirtualBox

Android, Is it possible to run Dalvik VM on any kind of OSs in order to run Android Applications?

I have some operating systems such as Windows 7 and Linux.
Is it possible to run Dalvik on this Win7 and after that running an Android application or game?
Thanks
One solution is to install Android-x86 (Android for Intel or AMD CPUs) either natively or in a virtual machine. If you only want to play some games and not to dual-boot with Windows and Android, you can use the excellent Android emulator Bluestacks. Just a warning, depending on your hardware (or virtual hardware) one version of Android-x86 may work better than another, you have to try. In a virtual machine most likely the virtual graphics card won't be detected properly, so you have to run it in VESA mode. I recommend editing the boot entry before running it and adding the commands:
nomodeset xforcevesa vga=ask
Then choose graphics mode to run Android-x86. This forces a specific VESA mode and most of the times the graphics are presented properly with correct colors on screen. Of course in that case you have a performance penalty. Some games may need to enable Developer Options and then force software rendering to be able to run them.
Android's virtual machine is tightly integrated with the OS (Linux). So, it is impossible to run it on Windows.
The lower-level components (OS and native libraries) in the Android system provide many services that Dalvik merely "translates" for the consumption of Java programs. So porting Dalvik to Windows is probably very hard and rather pointless.
dalvik can definitely run on (normal) linux, and it's likely it can also run in a cygwin environment on windows.
As for being able to run Android applications, that is quite a bit more complicated. However, the AOSP source does have a "simulator" build, which does just that - runs dalvik natively on the host machine and provides an android framework etc, for running android applications.
Keep in mind however that the simulator environment isn't actively maintained, and will probably require quite a bit of "love" to get it to work.
You can install Android on your PC with VirtualBox. Check out this tutorial.

Running Android apps in Linux

I have a Red Hat Linux (RHL) system on which I'd like to run Android apps. How would I do this? Is there an open-source port of the Android Runtime for linux? Kind of like a VM?
If not, what steps will I need to follow to port the runtime to RHL (with the Dalvik VM etc) so that I can run the android apps built by all android developers?
I am new to android so I am trying to understand if there is an application virtualization support for it from anyone. Thanks in advance!
You need to use dex2jar to convert an APK file to a JAR and then you need IcedRobot to run the Android stack above OpenJDK. Maybe I will try to emulate AndroidGL with JOGL 2.0 (it supports both OpenGL and OpenGL-ES). Keep in mind that it is not trivial.
The emulator of Android SDK is quite slow but you just have to enter adb install my_file.apk to install your application.
You can run android-x86 in VirtualBox or Live Android from a Live CD as Dimitri suggested but I'm not sure it is what you want.
P.S: The most promising solution seemed to be AndroVM.
P.S 2: ARChon Runtime works very well on 64-bits systems. This tutorial is very helpful to make it work.
P.S 3: App Runtime for Chrome Welder is even more promising, it's currently in beta. The final version will support all Android APIs in Google Chrome under GNU Linux (including Chrome OS), Mac OS X and Windows.
I know there is a project for porting Android on x86 platform. You can find iso to download and you can install on LiveCD : http://code.google.com/p/live-android/. You can find more information here
You can't just run Android apps - you will need the entire underlying Android operating system. That goes beyond a simple JVM. EDIT: There is actually a project in the works that aims to do that, see Dimitri's link.
But you're in luck - the Android SDK comes with an emulator that should fulfill your needs (although it's a bit on the slow side - if you're developing Android apps, you definitely want to use a physical device instead). The SDK is available here.
Run Bluestacks on Windows on VMWare on Linux. Easy.

Is possible install Eclipse IDE in a Galaxy Tab?

Since Eclipse can run in Linux and this tablet has the new Honeycomb (Linux Kernel), can Eclipse IDE run in Android Honeycomb ?
I know that isn't pretty much comfortable coding in a tablet, but I'd want to use for UML modeling.
Android (despite its Linux roots) is far from capable of running Eclipse IDE as is. Not only is the hardware inadequate for supporting such a large application, but Android lacks a full Java SE JVM (Dalvik is a subset) and SWT (Eclipse UI framework) implementation for native Android UI controls does not exist. On Linux, SWT implementations exist only for GTK and Motif.
You may be interested in project Orion, which is an effort at eclipse.org to create Eclipse-like experience in the browser. I understand that people have been able to use Orion from a mobile browser on devices such as the one on the iPad.
http://mmilinkov.wordpress.com/2011/01/11/introducing-orion/
No you can't.
But who forbid you to connect to your computer using VNC? You can access your Eclipse or whatever application you want.
You can't run Eclipse but you can try AIDE:
https://market.android.com/details?id=com.aide.ui
It is compatible with the Eclipse project file format, has a fast editor with syntax highlighting and supports the full edit-compile-run cycle.
1.) The latest Android tablets ARE now powerful enough to run software like the Eclipse IDE in fact they are more powerful than the Intel and AMD processor machines that Eclipse was originally developed to run on.
2.) The tablet is a useful tool for graphical modelling techniques and the addition of an external wireless keyboard can improve input of code in a text editor.
3.) There is a lack of support for Java SE runtime for Android.
4.) Limited Android root access on the standard commercially supplied Tablets make it impossible to access OS features and install, compile or access development tools without additional 3rd party applications.
5.) AIDE does provide a method to write and run code on Android but the free version is extremely limited and the commercial (paid) version is nowhere near as powerful or comprehensive as the freely available Eclipse for Windows or Linux.
You can use DroidDevelop.
DroidDevelop allows to create native Android application on your mobile device. You don't need to install Android SDK, Eclipce and an other desktop program for Windows or Linux to start programing for Android.
https://market.android.com/details?id=com.assoft.DroidDevelop
http://en.assoft.ru/droiddevelop
Short answer, no.
Long answer, although Honeycomb is based on Linux, you'd have to do a lot of hacking to get to the point where you can have a full blown IDE installed on it. Android works with apps. There isn't an Eclipse app, so you can't have Eclipse.
There was actually a version of Ubuntu for Android, you could do the Ubuntu install for Eclipse on your tablet if you were running it.
As for running Eclipse on an android OS? Not so much since Android has no real JVM.
The Eclipse downloads page lists packages for Windows, Linux, and Mac OSX.
Android is not listed as one of the supported OSes for installation of the IDE.
Are you talking about actually running Java code with Eclipse APIs on the device? It's not impossible, but you will be doing most of the work yourself. The difficult part will be getting SWT to run and appear as native Android objects while supporting the full range of controls that Eclipse users expect.
There have been Eclipse projects in the past to get a workable subset of the APIs to run in an embedded space. One such project was eRCP, by IBM. I'm not aware of any activity to make a similar effort on Android, but there's no requirement to announce such work to the Eclipse community.
Its not possible to install Eclipse directly to Android OS but you can run Eclipse on your Tablet via Linux Deploy Application. But first you need to get Linux setup on your Android and use VNC viewer for display. That's how I did it.
See screen shot of Linux on Android running Eclipse.

Is there a prefered Linux distro for Android Development?

I've seen some references to actually using Windows 7, however I expect that a Linux partition on my Laptop would be a better choice. Other than the Andriod SDK, what other dev tools are "essential" for Android?
I'd also be interested in knowing the system requirements for a reasonable IPad development system and "essentials" software beyond OSX and XCode. Plus what is the difference in the learning curves for the two platforms.
Eclipse + ADT is everything you need. OS makes no difference.
Depends:
If you're planning on creating your own fork of Android, or committing patches to the Android Open Source Project, then you need either a Linux distro or a case-sensitive partition on OS X. There are setup instructions for OS X and Ubuntu Linux on the Getting The Source of the AOSP site.
If you're planning on writing apps for Android, then it really depends on personal preference and development style:
If you're going to use Eclipse + ADT Plugin: Windows, Mac, and Linux will all work just fine.
Building from the command-line: You might be better off with OS X or Linux (you don't need to restrict yourself to any single distro) as they tend to have more command-line development tools pre installed.
Ubuntu is the one that springs to mind simply because getting help is easy and Canonical has been trying to make it easy to use. But as long as you can install a JVM, you're good to go. Remember, Java makes it possible to run apps (Eclipse in this case) without worrying about the OS.

Categories

Resources