As the question title states, can I install node.js on Android without root? I have a couple terminal emulator apps and at least one of them has BusyBox, git, and adp, among other things, though I am severely limited in what I can do with them. For example, I can not just git clone the node.js source code, as "No auth methods c[an] be used". I can download the node.js source code, but it seems to be under the "system_server" user as soon as it's downloaded, which I assume is the root user or very close. I am able to unpack it, but unable to run the configure executable in this directory, I assume because it is owned by root as soon as it is downloaded.
Am I trying the right approach here? I have heard about anode, but its wiki is empty and whatever instructions it has are confusing and do not say whether I need to be root. Everything else I have seen tells me I have to have a rooted Android to install node.js, but I hate to give up after so much effort.
Instead installing node.js on the android device, try jxcore.
You can download an android executable binary from its download page, and execute it from the terminal emulator. Remember to set up exec flags.
EDIT: jxcore seems no longer under development.
Related
I was asked to adapt our network testing libraries so that they are able to run on Android.
The application's base functionalities are written in Rust and include ping, dns, traceroute, etc.
I'll use ping as an example, but the same problem applies to other applications that rely on the creation of a raw socket. For instance, performing a DNS query using a standard UDP socket works without any problems.
The framework used for the actual Android app is Flutter.
For now, all tests were done using the Android Emulator inside Android Studio 2021.0.1 Patch 2.
As emulator images go, I tried on:
Android 12.0 x86_64 (API31)
Android 7 x86 (API24)
Android 7 armeabi-v7a (API24)
Android 11 arm64-v8a (API30)
I created a git repo with a minimal example of the entire application, in case anyone wants to test it out.
I'm binding Rust with Flutter using the Flutter Bridge Dart package. (Also in case you want to reproduce the bindings yourself).
The demo application is super simple and tries to focus on the problem at hand, which seems to be the creation of the RAW socket.
While searching for the solution, I've stumbled across a lot of information and I'm not entirely sure what's still relevant (mostly up to date) or not.
When searching for how to create a raw socket with an application built with NDK, I found this:
https://android-developers.narkive.com/BK5uGK4f/android-ndk-raw-socket-creation-problem
The author seems to have the same problem and the answer points out that this would not be possible because the application needs root access.
So, I tried doing adb root && adb remount. When I run adb shell, I'm given the root shell (#), and running tcpdump (which needs all types of access possible for network), seems to work.
Obviously, simply doing adb root did not fix my problem and the application (flutter run) still results in:
[ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: FfiException(PANIC_ERROR, called `Result::unwrap()` on an `Err` value: Os { code: 1, kind: PermissionDenied, message: "Operation not permitted" }, null)
So, my first thought was that the emulator was not rooted, or something like that, but after some research, I found out that, not only the device has to be rooted, but your app needs to ask for root access itself. So, I tried using this Dart library:
Root Access Plugin
That didn't work as well. The root access gets denied. This library uses a method that is similar to what's described in this Stack Overflow posting.
In order to provide an application with root capabilities, you need to call the application preceded by su.
I haven't tried creating a binary from the Rust library and calling it manually with su, mainly because I just couldn't get the cross-compilation to work for the target x86_64 Android architecture (but this is another very lengthy discussion).
In Linux, you can set the capabilities of the binary with setcap. For raw sockets, a simple setcap cap_net_raw+ep [binary] solves the issue. Of course, you need root or sudo for that. In Android, from my understanding, capabilities work differently. Here's a Stack Overflow posting that touches this subject.
It suggests that you can change the app's capabilities by requesting them in your manifest file. It didn't seem to work for me, but I'm not so sure I did that correctly.
For the emulator, I added
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_SUPERUSER"/>
<uses-permission android:name="android.permission.NET_RAW" />
to the android/app/src/debug/AndroidManifest.xml
SUMMARY
From my Flutter application, I want to be able to call my linked Rust library (compiled .so files), and the Rust code needs to have access to raw sockets.
So, how can I make this work?
I’m a mobile developer and recently adept at using containers with docker. I’m developing a container architecture for my graduate project. One of the modules of this architecture would need to be run on an android device. But I could not find information on how to run a container on an android device. It could be something simple like an alpine image with python.
Can anyone tell me if there is a possibility to run a container on an android device with docker, or even kubernetes?
In 2021, the answer is definitely yes.
Here is a tutorial on that topic, which shows you how to run docker directly on Android, without VMs nor chroot. Note that you do need to root your phone and build a custom kernel though.
If you only want a quick look of docker running on android without getting your hands dirty, check out this comment on GitHub.
It is possible to use it for running docker on an android device using an application like termux or userland to install a qemu package.
The best way is to use alpine linux terminal, an android app available on github.
This alpine term app has a QEMU to run like alpine ISO. All things are automated
and this works with x86_64 kernel on any android.
Some android phones have a KVM kernel so this device can run faster alpine term
Also my friends made a video on a YouTube channel to run docker on any android phone without root.
I must note that I am not an expert in Android development. But I researched on this topic, and #Emile's answer is the easiest and closest you can get - as it seems.
You can actually run Fedora (and not only) image on top of the Termux and then launch Python inside. This is obviously not a docker, but might be helpful.You can find more info here.
In addition, I've found this topic on Quora which is a similar question:
Think about it: Docker abstracts the OS and that is all. The Android
OS is quite a different kernel than linux distributions, even though
it is linux. It might be tricky to get applications meant for a linux
distribution to run on Android/Docker.
One of the main reasons to use docker is that it can provide
self-contained packages of applications which do not affect the rest
of the system. The Android applications, packaged as .apk files are
just that.
Other than that I was able to find this topic on StackOverflow which does not really resolve the issue. As the issue might be related to AUFS and some Kernel features needed by LXT which are not present in Android - now some of them is from what I remember.
Also there is a claim that it is possible on docker forum and weibo (use translation to English), but there is only a screenshot provided by user and no details on how to do it, besides "it took a lot of effort" statement. So it would seam that this is still a not well known part, or maybe someone will be able to actually provide more complementary information - maybe try on Docker forum or GitHub.
We open the Android container, which can run the docker container on the Android operating system. Not only can run Docker containers, but also other containers, such as podman. In addition, we have also enabled the container to support checkpoint and restore functions, and support the migration of containers across architectures and operating systems. See https://github.com/CGCL-codes/Android-Container for details.
Some people think it's impossible but it isn't you can run a full ubuntu on your phone by this android app https://play.google.com/store/apps/details?id=com.termux
You can even install gui envrioment and connect over vnc everything is supported in this so also docker or website hosting and so on
(Make sure you follow al install steps in the app https://play.google.com/store/apps/details?id=studio.com.techriz.andronix to install linuxes like arch or ubuntu fedora or more you have to install these it doesn't work by just opening termux)
YOU DON'T HAVE TO ROOT TO USE THIS METHOD
I'm trying to setup out team for Android development. This is proving to be a major PITA. I can make an AVD and I can run it locally. I can make it run for the git clone directory so long as I muck around with environment variables and make put everything in a .android/avd subdirectory.
But the .ini file has a full path in it, and it seems a relative path isn't working. How can I share the AVD? not everyone clones the repo into the same location and not everyone has the same username.
It seems like the whole SDK and all its tools are designed to only be used by single person teams, unless you jump through all kinds of hoops, or am I just missing something?
Usually each person pulls the project themselves, compiles it, and runs it on their own machine or device. If those people are not developers and normally wouldn't have eclipse/android studio installed then just export the APK file for them. They could then upload it to their device or emulator of their choice and run it. If you want to look into an alternative emulator I would suggest http://www.genymotion.com/. It runs a lot smoother and quicker than the standard android emulator.
I need to add scripting layer to my android App. So I can remotely prepare a script that my app download form a web service and execute on the user device.
I found a interesting project called Scripting Layer for Android (SL4A) here:
http://code.google.com/p/android-scripting/
I'm not sure I can execute Python script without installing the PythonForAndroid_r4.apk first. I can't force my customer to install that application!
So my question is, can the SL4A layer be integrated in my app without the need to install other apk?
I need to execute actions like update data in the DB, create/read/delete a file on the sd card... Not so complex but I see SL4A can do a lot of things like these.
Other scripting libraries?
EDIT:
Found also MVEL: http://mvel.codehaus.org/ but I think it needs to be integrated to execute complex operations like accessing a DB...
I found a project that uses SL4A:
http://code.google.com/p/android-python27/
For whom that wants to try it, if error occurs using Eclipse, here is a link that could solve the compilation issue:
http://code.google.com/p/android-python27/issues/detail?id=1
I've just compiled this project:
http://code.google.com/p/android-python27/source/browse/#hg%2Fapk
To download sources, download HG Tortoise from:
http://tortoisehg.bitbucket.io/download/
Make a local copy of the repository with the command:
hg clone https://code.google.com/p/android-python27/
Then import the APK project in Eclipse and compile it.
Just run it on my low cost China tablet and it seems to works fine. Initially the program make an installation:
boolean installNeeded = isInstallNeeded();
if(installNeeded) {
setContentView(R.layout.install);
new InstallAsyncTask().execute();
}
That make some installations on the external storage (fortunately no root privileges are needed).
I downloaded the c4droid app for Android and am running commands through system();. I'm learning that somethings work while others don't. Most of the cool stuff don't work and this appears to be due to my user profile not being given the rights to execute such commands at the Linux OS level.
So tried another experiment. I got a special Gnu compiler for the arm processor and compiled a simple hello world app. Then I put on my phone and tried to execute it through the c4droid app like system("./myapp.bin"); . I got a permission denied message.
So I'm just trying to understand what I can do and what I can't do on my phone that paid good money for? Can I execute such a hello world app or not? Do I really need root access to execute an application I made? Is there a way to get my code to run by wrapping it in android/java code? Do I have to go through the Dalvikvm to get this to run?
I'm really looking for a way to do this without rooting it or downloading something like busybox and using su.
Many many different issues.
permission denied is one of the few error messages the primitive shell knows, and it's used for many other types of failures including not finding the requested command.
The toolbox suite is missing many typical unix commands. People sometimes install busybox as a more comprehensive supplement
Some of the things you may want to do will actually require permissions that the shell (or even more so, application user id) accounts do not have. Only on an emulator or engineering device does the adb shell run as root by default, though on a 'rooted' device you may be able to get to a root shell.
You do not need root access to run compiled code, however the code must have a suitable ABI, must have all it's library dependencies satisfied, and must be installed in a file with the executable flag, on a partition which is not mounted with non-executable flag. Some of the issues you face there are glibc (or other) vs Android's bionic libc. Executable scratch directories vary by android version, though the private storage area of an app is an option if the app sets the file to world readable and executable.
The usual (and only "recommended") means of running native code is to build it as a shared library linked against android's Bionic libc, and call into it from a dalvik/java app using JNI.