This project has been on hold since 2016.
All the data on this site is still available (and will stay available) but not actual anymore.
You might be interested in checking out Dmitry Moskalchuk's portfolio website to learn about his other projects.

Description

This is a distribution of the CrystaX NDK, which has been developed as a drop-in replacement for Google's Android NDK (Native Development Kit). Compared to Google's NDK, the CrystaX NDK provides the same functionality as well as several great features and tons of fixes and improvements.

The main goal of the CrystaX NDK is to allow Android developers to produce standard conformant code and thus make Android native development more efficient. The CrystaX NDK dramatically decreases development time allowing usage of standard code working on multiple platforms (iOS, OS X, Windows, Linux, etc.) instead of distracting developers with Android's peculiarities and forcing coders to try to workaround them (or even write separate Android-specific implementations of functionality already implemented for another platform if a detected problem cannot be easily worked around).

Unfortunately, Android libc (Bionic) has very limited functionality (which differs from one Android version to another), so developers have been forced to take into account all its peculiarities, detecting in run-time which specific Android version the application is running on and applying specific workarounds. With CrystaX NDK, developers can forget about such problems, since CrystaX NDK provides complementary libcrystax, which is used to hide such differences between Android versions or even re-implement many of libc functions. Most importantly, with the help of libcrystax, the application behaves the same on all Android devices regardless of Android version.

Another goal of CrystaX NDK is to make some great features available for the Android native world. For example, support of Objective-C and another programming languages.

This project was initially started as a personal project of Dmitry Moskalchuk with the intention to just add missing C++ support (C++ exceptions, RTTI, and the Standard C++ Library) to the Google's Android NDK, but with time, many additional needs were discovered, and it turned out that improving the CrystaX NDK step-by-step was in fact the best way to force an evolution of native Android development. Since its beginning in 2009, numerous open-source and commercial projects have used the CrystaX NDK for porting and development for Android with minimal effort.

Nowadays, CrystaX NDK offers numerous great features, making native development for Android easier. See below the key features of the CrystaX NDK.

Features

  1. Full support of wide characters

    Wide characters are part of C and C++ languages and their standard libraries. For example, the C standard library provides functions allowing work with wide strings such as wcsnlen, wcsncasecmp, wcsncmp and others; the C++ standard library provides wchar_t specializations of standard C++ classes such as std::basic_string, std::basic_ostream, std::basic_regex etc. Unfortunately, Android libc (Bionic) either doesn't support wide characters at all or supports them in a very limited manner, depending on Android version.

    With the CrystaX NDK, you get fully standard-compliant wide characters support, including multibyte-to-wide and vice versa conversions. You can easily port existing code or write new code that uses wide characters, strings, streams, and regular expressions not distracting on Android's peculiarities.

    Example

  2. Full support of C locales

    Android libc (Bionic) has no native support of locales, so the only way to use localized input/output in native code is to implement localization in Java and refer to it through JNI. Obviously, such an approach adds significant run-time overhead, but it's the only choice if you're using Google's Android NDK.

    Now, with CrystaX NDK, locales are supported natively, so just set a locale with standard setlocale and all further C standard function calls will use that locale for input and output. CrystaX NDK also supports so-called "extended locales" (part of IEEE Std 1003.1, 2013 Edition), providing companion locale-enabled functions for many standard C interfaces, such as printf_l, strftime_l, strfmon_l and others.

    Example

  3. Full math support, including complex and type-generic math functions

    ISO C standard defines headers <tgmath.h> and <complex.h>. In Google's Android NDK, <complex.h> appears only starting from r10 and only for applications targeting Android 5.0 (android-21 platform), whereas type-generic math functions are not supported at all.

    With CrystaX NDK, you get fully working complex and type-generic math regardless of the target Android version. Nothing more to say - just use it as defined in ISO C standard and enjoy!

  4. The most recent toolchains

    The CrystaX NDK includes the most recent versions of GCC and Clang compilers. This allows developers to use new language abilities, such as new C++11/C++14 features. All compilers are built with high- and low-level optimizations, which enable generation of the most efficient code for target hardware.

  5. C++11/C++14 support

    Since the CrystaX NDK includes the most recent versions of GCC and Clang, it supports all C++11/C++14 features listed on C++11 Support in GCC, C++14 Support in GCC and C++ Support in Clang.

  6. Full C++ standard library

    In addition, the CrystaX NDK offers a fully working C++11 standard library, including classes std::thread and std::mutex, functions/classes from std::chrono, and functions std::stol, std::stoul etc. These classes and functions are not available (or available with restrictions) in the Google's Android NDK because of a lack of functionality in Android libc (Bionic).

    In the CrystaX NDK, we've taken care of the completeness of the C++ standard library and have fixed all such issues, so the full C++ standard library is available no matter which implementation you're using - GNU libstdc++ or LLVM libc++.

    By the way, LLVM libc++ in CrystaX NDK is a first-class citizen, the same as GNU libstdc++, so you're free to use either one of them, your choice. By default, GNU libstdc++ is used.

    Example

  7. Boost C++ libraries out of the box

    We provide prebuilt Boost C++ libraries (as well as header-only libraries) out of the box. Boost usage become as simple as can be. No need to build Boost libraries on your own anymore; no need to figure out what's wrong when it fails. Most important, Boost C++ libraries works much better with CrystaX NDK than the same libraries built by Google's NDK - because in CrystaX NDK they works on top of the much more standard-conformant base (yes, it's libcrystax, core of the CrystaX NDK).

    Here you can see an example of how to start using Boost C++ libraries in your Android project.

  8. Objective-C and Objective-C++ support

    The only languages Google's NDK supports are C and C++. CrystaX NDK adds support of Objective-C and Objective-C++ in addition to C and C++.

    Starting from CrystaX NDK 10.2.0, we've added support of Objective-C v2 runtime and initial frameworks (Foundation and CoreFoundation).

    Here you can see a simple example of how to use Objective-C for Android development. In two words, just add source files with the extension .m (Objective-C) or .mm (Objective-C++), specify them in LOCAL_SRC_FILES in Android.mk and add "APP_OBJC := cocotron" in Application.mk.

  9. Tons of fixes and improvements of standard C library implementation

    It's a well-known fact that Android libc (Bionic) has many bugs in its implementation of standard C functions. For example, one of the most notorious bugs is strtod implementation, which works properly only for the simplest input string formats and fails for others required by ISO C Standard. Some of these bugs are fixed over time, others aren't. Anyway, even if some bugs are fixed, such fixes don't affect previously released Android versions, so developers are forced to live with them or implement their own workarounds. This significantly increases time for development or porting of native Android applications.

    In CrystaX NDK, we've implemented our own versions of such buggy functions in libcrystax and have done so without altering the typical development work flow. Compilers/linkers use libcrystax transparently for developers so one won't even know that a libcrystax implementation is being used instead of a Bionic (except for the fact that the behaviour has been fixed). Also, using CrystaX NDK, you'll never run into a situation where a bug fix is available only for specific Android versions. When we fix anything in libcrystax, we ensure it works on all Android versions.

  10. To be continued...

    If you don't see a great feature here, don't hesitate to contact us and ask for it. You can also use our issue/bug tracker to report bugs or feature requests. And, of course, your contributions are welcome!

License

The content of the CrystaX NDK is covered by various open-source licenses. See the copyright disclaimers in each respective file for details.

Note that the CrystaX NDK release packages also contain prebuilt binaries for the compiler, linker, archiver, etc. The source codes for the toolchains are available at GitHub (you can use the build script to download it automatically).

The prebuilt GCC and companion binaries (GDB, binutils etc) are covered by either the GNU General Public License (GPL) or the GNU Lesser General Public License (LGPL). For details, see the files COPYING and COPYING.LIB under $NDK/toolchains/$tc/prebuilt/$system.

The prebuilt LLVM/Clang toolchains are covered by the LLVM "BSD" license.

Basically, licensing rules are the same as for Google's Android NDK - i.e., both commercial and non-commercial usage allowed. The only additions are regarding CrystaX parts, which are covered by a permissive BSD 2-clause license.

Feedback

We're working hard on making CrystaX NDK as good as possible. However, there is no guarantee it's bug-free - as everything in this world. So if you find a bug, please report it to us and we'll do our best to fix it.

Also, you can use the public discussion group to ask about CrystaX NDK (for example, if you're unsure if something is a bug or feature). You can post a question via the web interface or use it as a good old mailing list: send e-mail to crystax-ndk@googlegroups.com. This is a pre-moderated group, so don't worry if you don't see your post immediately; give us some time to see and approve it.

Finally, you can directly contact us if the above options don't fit your needs.

Download

File Size SHA256
crystax-ndk-10.3.2-windows-x86.exe 740.503 MB 610af4c541d0831...fe842f3434b773
crystax-ndk-10.3.2-windows-x86_64.exe 795.952 MB 3935afe8348fdea...fbc3e205ac376a
crystax-ndk-10.3.2-darwin-x86.tar.xz 733.775 MB 55ac4d7dae81c5e...0f2b506c530c61
crystax-ndk-10.3.2-darwin-x86_64.tar.xz 704.849 MB 382bc6bf8bf4fb1...5f5c9975d3d7bf
crystax-ndk-10.3.2-linux-x86.tar.xz 699.613 MB aa29fe97e283e88...ac426042b3c952
crystax-ndk-10.3.2-linux-x86_64.tar.xz 706.139 MB 7305b59a3cee178...8d68157356c4c0

How to build

You can also build the distribution from sources if you don't want to use the prebuilt versions for some reason. Follow the instructions below.

Setting up the build environment:

Follow the instructions from the AOSP site (except the Java part):

WARNING!!! Building the Windows version of CrystaX NDK is only supported on a Linux host (cross-build used). Building on a Windows host is not tested and not supported.

Building NDK

  • Download the build script and run it.
    Example:
    \curl -sSL http://crystax.net/download/ndk-crystax-r10-build.sh | /bin/bash
    It will take a long time - up to many hours. When the script is finished, it will print the directory containing the package with the NDK release.
  • You're done! Use this package as a drop-in replacement for Google's NDK!

Back
Home
Map
Back
Home
Map

Our contributors: