Can Linux apps be run in Android?

前端 未结 14 1640
旧时难觅i
旧时难觅i 2020-12-07 16:23

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

相关标签:
14条回答
  • 2020-12-07 16:57

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

    0 讨论(0)
  • 2020-12-07 16:58

    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.)

    0 讨论(0)
  • 2020-12-07 17:01

    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... :/

    0 讨论(0)
  • 2020-12-07 17:02

    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.

    0 讨论(0)
  • 2020-12-07 17:03

    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.

    0 讨论(0)
  • 2020-12-07 17:04

    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:

    1. 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.

    2. 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.

    0 讨论(0)
提交回复
热议问题