How to build and setup for Android on Linux (2.3+)
Note: if you are on Windows, we now have a NuGet package! Go straight to
Use on Android to get started.
First, follow all the instructions on
Setup and Build on Linux
. While some steps could be skipped if you only
want to build for Android, it is useful to diagnose problems with a desktop build first.
Second, while our dependencies require a Linux system to build, once they are built you can transfer the products to a Windows computer and use them with your existing Android project under Eclipse. More information on this is provided in the relevant step.
The C++ REST SDK depends on Boost, libiconv, and OpenSSL when used on Android. The script below will compile all of these dependencies for you.
For this walkthrough, we assume you are working within the
directory of the C++ REST SDK.
git clone https://git01.codeplex.com/casablanca
Install the Android NDK
The following instructions are written and tested against the android NDK version r10. Future and past versions may or may not work. The android NDK is available at
. If version r10 is not available for download, hard links are provided below.
For this tutorial, we assume it is installed at ~/android-ndk-r10/
Building the C++ REST SDK
../configure.sh --ndk ~/android-ndk-r10
This will build armv7 binaries under the build.armv7.debug/Binaries
Using the C++ REST SDK
Use on Android
If you want to run the tests for Android we have a test runner project that can used. All the tests can be built by running msbuild from the command line. For example the following setups up the Visual Studio tools and builds x86 Debug for the simulator.
msbuild /p:Platform=x86 /p:Configuration=Debug
Once the build completes open the following androidproj file in Visual Studio, which packages the tests.
Make sure the configuration is x86 Debug and then start debugging with F5. This will launch the Android emulator and start running the tests. Output of the tests goes to Logcat, which can be brought up the Visual Studio menu with Tools->Android Tools->Logcat.
Look for messages with the tag 'UnitTestpp', in particular at the end of running the tests there are several '--- Flush buffer ---' messages in a row.
For reference, the older documentation is available at
Setup and Build on Android 2.2