Following are the minimum required versions for the tools and libraries you need for building LiquidFun for Android:
Each LiquidFun project for Android has an associated AndroidManifest.xml
file and jni
subdirectory. For samples, AndroidManifest.xml
contains
details about how to build an Android package (apk). For libraries, such as
LiquidFun and freeglut, the AndroidManifest.xml
file informs the ndk-build
tool that the directory contains NDK makefiles under the jni
subdirectory.
The following Android NDK projects live in the liquidfun directory tree.
liquidfun/Box2D
- liquidfun dynamic and static libraries.liquidfun/Box2D/HelloWorld
- Non-interactive Hello World sample
application.liquidfun/Box2D/Testbed
- Interactive Testbed sample application.To build an Android NDK project:
For example, to build the LiquidFun dynamic and static libraries:
cd liquidfun/Box2D
ndk-build
Running a sample requires the Android Development Tools (ADT) plugin and the NDK Eclipse plugin.
ndk-build
(see above).Root Directory:
and select the
project folder (e.g. liquidfun/Box2D/Testbed
).If you do not have a physical device, you must define a virtual one. For details about how to define a virtual device, see managing avds. We don’t recommend a virtual device for development.
If the target is a physical device, unlock the device and observe the application executing.
It's also possible to use build_apk.sh
to build, deploy, and execute an application.
build_apk.sh
requires the installation of the Android NDK and Android SDK.
On Windows the script requires that you install [Cygwin][], as it
makes use of Bash and common UNIX utilities. In addition, build_apk.sh
requires the addition of the Android SDK sdk/tools
, Android SDK
sdk/platform-tools
and Android NDK root directories to the PATH
environment variable.
To build and run an application using build_apk.sh
:
For example, the following will build the Testbed application, deploy it to the connected device, and start it:
cd liquidfun/Box2D/Testbed
../AndroidUtil/build_apk.sh
By default, code is generated for devices that support the armeabi-v7a
ABI.
Alternatively, you can generate a fat .apk
that includes code for all ABIs.
To do so, override APP_ABI on ndk-build's command line:
ndk-build APP_ABI=all
Developers modifying the LiquidFun library can verify that it is still working correctly by executing the provided unit tests.
Use the run_tests_android.sh script to execute unit tests:
./liquidfun/Box2D/Unittests/run_tests_android.sh
run_tests_android.sh
uses build_apk.sh
to build, deploy, and
execute each unit test on the connected device.
The "Build and Run from the Command Line" section above describes
the setup requirements for build_apk.sh
.