Listing 132 Build script for Hello Android buildhellobat

arm-none-linux-gnueabi-gcc hello.c -static -o hellostatic <1—1O Compile and link g:\tools\adb push hellostatic /data/ch13 <1—Q Copy file g:\tools\adb shell "chmod 777 /data/ch13/hellostatic" <—© Change permissions

A call to arm-none-linux-gnueabi-gcc O compiles the source file, hello.c. The file is statically linked against the standard C libraries, and the resulting binary executable file is written out as hellostatic. The file hellostatic is copied to the Android Emulator Q and placed in the directory /data/ch13. The permissions for this file are changed ©, permitting execution. Note the use of the adb shell with a quote-delimited command. Once this command executes, the adb application exits and returns to the Windows command prompt.

This example can be extended to perform other build steps or cleanup procedures such as removing temporary test data files on the Android Emulator or any similarly helpful tasks. As you progress, it will become clear what commands to put into your build script to make the testing process more efficient.

Now that the pressure is off—we have successfully written, built, and executed an application in the Android/Linux environment—it is time to deal with the problematic issue of a simple application requiring a file size of half a megabyte.

0 0

Post a comment