I have been trying to port Node.js on Android phone
by following the link below
http://www.xydo.com/toolbar/20311835-node_js_on_android
I created the node.tar on QEMU environment and sent it to the ubuntu machine ?
I have put all .so files in system/lib and node bin file in system/bin .
When i try to run it it gives "Node not Found " even though it is present .
NOTE : I have manually pushed the files since tar command does not work on android .
I am using a rooted device .
Is there any way to create the binary file in android directly without the ARM environment ???
Am i missing something ?Thanks for the help .
Thanks for the response .
I have installed debian on Android using your suggested link:
http://lanrat.com/android/debian
After that, when I run the following commands on chroot to be able to make and install Node js, (ref:http://howtonode.org/f1932c1c56d3a50fe0c21998362d80f405229b5a/arm-chroot-fun)
$git clone http://github.com/creationix/nvm.git
$. nvm/nvm.sh
$export JOBS=1
$nvm install v0.4.11
I get the following error:
/.nvm/src/node-v0.4.11/deps/v8/src/arm/macro-assembler-arm.cc:61:3: error: #error "For thumb inter-working we require an architecture which supports blx"
scons: *** [obj/release/arm/macro-assembler-arm.o] Error 1
scons: building terminated because of errors.
Waf: Leaving directory `/.nvm/src/node-v0.4.11/build'
Build failed: -> task failed (err #2):
{task: libv8.a SConstruct -> libv8.a}
Alternately, if I try the following:
$ mkdir tmp
$ cd tmp
$ wget http://nodejs.org/dist/node-v0.4.11.tar.gz
$ tar -xvzf node-v0.4.11.tar.gz
Added '-march=armv5t' to 'CCFLAGS',in node-v0.4.11/deps/v8/SConstruct and the
$ cd node-v0.4.11
$ ./configure
$ make
$ make install
the installation runs without errors, node --version reports v0.4.11 and when I try to run any node commands, I get pure virtual method called terminate called without an active exception Aborted
can you please let me know what i am doing wrong here?
You definitely have tar on your phone and everything else that comes with busybox! http://en.wikipedia.org/wiki/BusyBox Also look at this it will improve your Droid hacking time 10 fold https://github.com/jackpal/Android-Terminal-Emulator/wiki/Frequently-Asked-Questionsand consider acquiring http://www.magicandroidapps.com/wiki//index.php?title=Main_Page and https://market.android.com/details?id=org.pocketworkstation.pckeyboard Your going to wonder how you where doing it before you got these. The tutorial you where following was a little shaky so I included the resources I used to get ubuntu and nodejs running on my Android. It took me a while but it was a lot easier after a little research on how exactly debootstrap and qemu worked, you have to get a little linuxy but once its running you will be amazed at all the options you have. http://lanrat.com/android/debian http://howtonode.org/f1932c1c56d3a50fe0c21998362d80f405229b5a/arm-chroot-fun What I ended up doing was building a cross compilation tool kit using deb boot strap and qemu and compiling everything on my desktop then moving the image over to my Android. Lastly I included my arm ubuntu Image. You may have to tweak the bash script a bit but other then that the image is universal and even runs on an IPhone. If you have any trouble digesting all this or getting the image working feel free to ask. I want to see node on as many phones as possible! www.castedspell.com/ubuntu4droid.tar.gz The image is 3 gigs uncompressed but really only 600 mb and you can use any partition re-size tool to shrink it down.
There is an Android port of NodeJS with source you can get up and running with.
Related
I saw some links and posts about running AndroidTest in Docker. Like:
https://dzone.com/articles/running-android-tests-in-docker
https://github.com/ksoichiro/android-tests/tree/master/docker-emulator
And some more. However, they all seem inappropriate for AndroidTest in CI, since they require an actual VM, or simply they are too old.
I tried the following lines Docker Image (Partial):
RUN /opt/adk/tools/bin/sdkmanager "emulator" "build-tools;${BUILD_TOOLS}" "platforms;${ANDROID_PLATFORM}" "system-images;${ANDROID_PLATFORM};google_apis;armeabi-v7a" \
&& echo no | /opt/adk/tools/bin/avdmanager create avd -n "Android" -k "system-images;${ANDROID_PLATFORM};google_apis;armeabi-v7a" \
And then I run the emulator using:
/opt/adk/emulator/emulator #Android -writable-system -nocache -no-snapstorage &
However, when trying to run connectedAndroidTest there were some weird exceptions, like:
Caused by: com.android.ddmlib.InstallException: Unknown failure: Error: Could not access the Package Manager. Is the system running?
Or, if I try to manually install the test APK, and run am instrument:
android.util.AndroidException: Can't connect to activity manager; is the system running?
So my question: Is anyone is running AndroidTest on emulator as part of the CI on docker? Means, an image that you just need to mount your project and run gradle connectedAndroidTest, and everything works? Is there a working example for that?
I run AndroidTest on emulator as part of the CI on docker using this image: https://hub.docker.com/r/chrisss404/android-emulator
The problem you might encounter is that hardware acceleration is not available on your host because of missing nested KVM (just a guess, but that was the problem I was facing). In this case you have to use software rendering, which can take a significant amount of time.
With software rendering, the startup takes about 40 minutes until the emulator is usable (on my host). However, then you can run the instrumentation tests as usual in an acceptable timeframe.
I am trying to run a emulator from the Android source by loading the goldfish kernel with some of my configuration changes. Though I found a lot of questions on this, but could not find my answer.
1. I downloaded the android source.
2. I also successfully built my goldfish kernel. Now I can see the zImage in the /goldfish/arch/arm/boot folder.
After this I tried running this emulator by referring to a lot of similar questions.
Building Android from source - emulator and AVDs, Running emulator after building Android from source, How to compile android goldfish 3.4 kernel and run on emulator. But unfortunately didn't solve my problem. When I try to run the emulator with :
./emulator -debug init -kernel Thepath/goldfish/arch/arm/boot/zImage -avd firstAvd -wipe-data
I get an error that AVD is not found. I then found this blog, https://yaapb.wordpress.com/2012/09/22/build-a-custom-android-emulator-image/ where it says to first make the emulator from the source tree by the following commands:
$ source build/envsetup.sh
$ lunch full-eng
$ make -j4
$ emulator -wipe-data &
Then to run the emulator with my modified kernel, I need to run :
$ cd ${ANDROID_BUILD_TOP}
$ emulator -kernel ~/workspace/android/goldfish/arch/arm/boot/zImage -wipe-data &
Though I am trying to do this, the process of creating the emulator with the make command is taking hours. 7% in 90 mins till now. So in the mean time I wanted to know if anyone can tell me that to run an emulator with my kernel, do I need to first create an emulator from the source? Also, I dont find the system.img, ramdisk.img files in the android source tree. Is it normal or I ge them when I create an emulator?
**
EDIT
**
I would also like to know if I can run the emulator without the make -j4. The Android source tree also includes the SDK. Can I run the Emulator from the SDK. If yes, how? The google official docs say to run the following command form the /tools folder in the sdk. But there is no tools folder in the sdk folder.
After you have built the sources, you should not run build process once again in order to use the emulator. Simply go to the folder with your AOSP code and run the following commands:
$ cd ${ANDROID_BUILD_TOP}
$ source build/envsetup.sh
$ emulator -kernel ~/workspace/android/goldfish/arch/arm/boot/zImage -wipe-data &
The command source build/envsetup.sh will add additional commands to your shell, and you should be able to run emulator without building it one more time from scratch.
I haven't read anything explicitly stating that you can't use Windows but everything that does walk you through what to do seems to involve running a .sh file. Has anybody had any luck compiling any kind of Go for Android, whether it be a library or a full native activity?
No, the all process is tied to Linux (FROM ubuntu:12.04 in the Dockerfile).
That means you would need to have on Windows a Docker-compliant environment (like a boot2docker) in order to launch the
docker run -v $GOPATH/src:/src mobile /bin/bash -c 'cd /src/your/project && ./make.bash'
I am following Google's instructions
to build Android on Ubuntu 12.04.
Somewhere on https://source.android.com/source/building-devices.html it says
If you don't already have those tools, fastboot and adb can be built
with the regular build system. Follow the instructions on the page
about Building and Running, and replace the main make command with
$ make fastboot adb
After using that command, the compile seems to complete fine. I then found an adb binary at
<path>/out/target/product/generic/system/bin/adb
However, when I try to use that I get an "cannot execute binary file" error.
Could it be that it was compiled for the wrong architecture? Do I need to configure something (e.g., with lunch) before the "make fastboot adb"?
Found the solution myself. I was looking at the wrong binary. The right one was at
<path>/out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb
Now
adb devices
produces a list of devices (with one entry for the phone).
I'm using Terminal-IDE as my development environment. (Google code site here.)
I'm running Terminal-IDE v 2.02 - the very latest. My Android versions are:
Android 4.0.3
Software version 2.14.531.3 71ORD
(the rest aren't likely pertinent, but more on request)
I'm in a suitable development directory with a simple enough c source code file ready and run 'make'.
I have never yet gotten any compilation to work successfully. Most likely, there's a version mis-match with regard to what executable is available versus what the software is looking for.
Here's the command and error message:
terminal-gcc -c -Wall -I/data/data/com.spartacusrex.spartacuside/files/local/include tester.c -o tester.o
/data/data/com.spartacusrex.spartacuside/files/system/bin/terminal-gcc[43]: arm-eabi-gcc: not found
make: *** [tester.o] Error 127
Snafu, of course. I'm not at all sure how to find out what the right compiler file name(s) should be because, on this non-rooted phone, I don't have permissions to hunt through the PATH and find the actual executables.
It may also be that PATH is set wrong. All input appreciated.
...I'm not sure what's supposed to happen, but I found in the Terminal-IDE directory tree the file:
$IDESYSTEM/android-gcc-4.4.0.tar.gz
I also found that terminal-gcc is a bash script. Looking inside it seemed to say that a gcc tree should exist in "$HOME", which is the installation directory. So, I unzipped, then un-tarred the file identified above and put the resulting directory tree as a top-level subdirectory.
Well well, what do you know? Success.
I went a little further and created soft links to the actual compiler in ~/bin for both gcc and just cc, and suddenly all my previously created "Makefile" scripts used in other projects I wanted to move over started working perfectly.
Apparently, even though I thought I'd done it right, I overlooked running this script:
./system/bin/install_gcc
It extracts the tar, like I did, but does not create the links you may need.
Hey, if you're glad I got here before you, give it a thumbs up!
A credit goes to #Richard T for his enthusiasm regarding Terminal IDE. The answer is intended to enumerate the steps needed for running a C code.
To run a C code
Run Terminal IDE and extract the gcc package by executing
install_gcc
Create a directory for your projects within the Terminal IDE directory tree. Then in the directory create a source .c file with some code (filename.c here). Compile it
terminal-gcc -c filename.c
Create the executable file
terminal-gcc filename.o -o filename.out
Run the output file
./filename.out
If you'd like to use the PC (laptop) keyboard you can telnet Terminal IDE.
To Telnet Terminal IDE
From Terminal IDE start the telnetd deamon by executing
telnetd
Connect the Android device to the PC (laptop) and type
adb forward tcp:[port] tcp:8080
telnet 127.0.0.1 [port]
P.S. Telnet's default port is 23.