5

当我在 Windows CMD 中输入这个...

red -c -t Android hello.red

...Red 输出一个hello没有文件扩展名的文件。如果我将此文件传输到我的 Android 设备,它不知道如何处理它。

我必须遵循哪些额外步骤才能在我的 Android 设备上测试我的 Red 代码?根据我的代码是否会尝试使用 Android 网桥,我必须采取哪些不同的步骤(如果有)?

4

4 回答 4

5

Android 移植是在android分支中完成的一项工作。在该分支中,使用:

red -t Android <script.red>

将为新的打包层使用 APK 后端,它将为您处理 APK 生成的整个过程(前提是您预装了 JDK1.6+)。如果一切顺利,您将在工作文件夹中获得一个 APK。

如果您需要调试构建过程,您需要编辑system/formats/APK.r文件并在第 11 行将verbose单词设置为 yes。

注意:我们正在努力一一删除所有外部依赖项。

编辑:Android Red 端口已移至私有分支并积极开展工作。一旦达到测试阶段,它将被公开。

于 2014-07-14T10:59:58.420 回答
3

除非您将可执行文件打包到 .APK 中,否则出于安全原因,Android 会在您 chmod +x 并运行的路径中设置一些障碍。

我遵循了这些指示,只是:

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

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

$ chmod 755 ./hello

$ ./hello

如果没有生根或其他方式,您最终会遇到这种奇怪的情况,例如使用cat而不是cp,并将文件滑入一个允许执行的奇怪目录。

在 Nexus 5 上测试。

于 2014-06-23T10:04:52.817 回答
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.

于 2014-07-09T22:20:10.983 回答
1

我还没有尝试过,但检查一下:http ://www.red-lang.org/2011/12/arm-support-released.html 你也可能知道,这里有一个实验性的 Android 版本:https: //github.com/red/red/tree/android

于 2014-06-23T09:05:58.647 回答