How do I run an Android app I've written in Red?
Asked Answered
C

4

5

When I enter this in the Windows CMD...

red -c -t Android hello.red

...Red outputs a file called hello with no filename extension. If I transfer this file to my Android device, it doesn't know what to do with it.

What additional steps must I follow to test my Red code on my Android device? Which of those steps, if any, must I do differently, depending on whether or not my code will attempt to use the Android bridge?

Confirmand answered 23/6, 2014 at 7:58 Comment(0)
I
5

The Android port is a work in progress done in the android branch. In that branch, using:

red -t Android <script.red>

will use the APK backend for the new packaging layer that will handle the whole process of APK generation for you (provided that you have a JDK1.6+ pre-installed). If all went well, you will get an APK in your working folder.

In case you need to debug the building process, you need to edit the system/formats/APK.r file and set on line 11 the verbose word to yes.

Note: We are working on removing all the external dependencies one by one.

EDIT: The Android Red port has been moved to a private branch and actively worked on. It will be made public once beta stage is reached.

Islam answered 14/7, 2014 at 10:59 Comment(0)
E
3

Unless you package up the executable into an .APK, then for security reasons Android throws up some walls in your path to chmod +x it and run.

I followed these directions, just with:

$ cd /data/data/jackpal.androidterm/shared_prefs

$ cat /sdcard/Download/hello.bin > hello

$ chmod 755 ./hello

$ ./hello

Without rooting or otherwise, you wind up with that weirdness like using cat instead of cp, and slipping the file into a strange directory where execution is allowed.

Tested on Nexus 5.

Event answered 23/6, 2014 at 10:4 Comment(2)
Halfway there. This worked for %tests/hello.red, but not for the bridge examples: %bridges/android/samples/eval/eval.red %bridges/java/hello.red For me, the prompt simply returned to the next line without any errors or actions after ./eval or ./hello. When intending to use the bridge, is it necessary to package the executable into an .APK after all? What else must I do before I can use the bridge?Confirmand
The Java bridge example is intended to run with a plain JVM with JNI support. Instructions how to run it are contained in the accompanying README. The Android bridge example is only a proof of concept and indeed needs to be packaged up into an .APK. To do so, you either run build.r from Rebol 2, or download the pre-built .APK linked to in the blog post announcing the Android proof-of-concept.Taken
S
1

I've not tried yet, but check this: http://www.red-lang.org/2011/12/arm-support-released.html Also you may know, that there is an experimental Android version here: https://github.com/red/red/tree/android

Subaqueous answered 23/6, 2014 at 9:5 Comment(1)
Note that Red is still in alpha state, so don't expect too much;-)Subaqueous
W
1

It appears the question has been answered, but for those who want more, there is an article for getting started with Red for Linux and Android in the March 2014 issue of ODROID Magazine at http://magazine.odroid.com .

There is also going to be a short how-to article in the July 2014 edition (released in the next few days) by Gregory Pecheret that will demonstrate building an .apk from scratch in Red.

Winni answered 9/7, 2014 at 22:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.