Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

android

red

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?

like image 735
WiseGenius Avatar asked Jun 23 '14 07:06

WiseGenius


4 Answers

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.

like image 98
DocKimbel Avatar answered Oct 22 '22 19:10

DocKimbel


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.

like image 39
HostileFork says dont trust SE Avatar answered Oct 22 '22 21:10

HostileFork says dont trust SE


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

like image 21
Oldes Avatar answered Oct 22 '22 21:10

Oldes


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.

like image 39
Respectech Avatar answered Oct 22 '22 21:10

Respectech