title: Android Studio 14 Native Development + CrystaX NDK
body: <p>I am trying to migrate a huge crossplatform C++11 (iOS+Android) app project into Android Studio 14. I am using CrystaX NDK for boost and C++14. There's an official Android Studio + CrystaX tutorial on their website's blog <a href="https://www.crystax.net/en/blog/3" rel="nofollow">here</a> but it's outdated. </p>
  
  <p>I've downloaded the official hello-jni example that is meant to work with Android Studio 1.4 and tried to adapt it to work with CrystaX NDK. These are my Gradle 2.5 settings:</p>
  
  <p><strong>project build.gradle</strong></p>
  
  <pre><code>// Top-level build file where you can add configuration options common to all sub-projects/modules.
  buildscript {
      repositories {
         jcenter()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle-experimental:0.2.0'
      }
  }
  
  allprojects {
      repositories {
          jcenter()
      }
  }
  </code></pre>
  
  <p><strong>module build.gradle</strong></p>
  
  <pre><code>apply plugin: 'com.android.model.application'
  
  model {
      android {
          compileSdkVersion = 23
          buildToolsVersion = "23.0.1"
  
          defaultConfig.with {
              applicationId = "com.tableair.app"
              minSdkVersion.apiLevel = 4
              targetSdkVersion.apiLevel = 23
          }
      }
  
      compileOptions.with {
          sourceCompatibility=JavaVersion.VERSION_1_7
          targetCompatibility=JavaVersion.VERSION_1_7
      }
  
      /*
       * native build settings
       */
      android.ndk {
          moduleName = "tableair-framework"
          cppFlags += "-std=c++11"
          cppFlags += "-Werror"
          ldLibs = ["android", "log", "GLESv2", "crystax"]
          stl = "gnustl_static"
          /*
           * Other ndk flags configurable here are
           * cppFlags += "-fno-rtti"
           * cppFlags += "-fno-exceptions"
           * ldLibs    = ["android", "log"]
           * stl       = "system"
           */
      }
      android.buildTypes {
          release {
              minifyEnabled = false
              proguardFiles  += file('proguard-rules.txt')
          }
      }
      android.productFlavors {
          // for detailed abiFilter descriptions, refer to "Supported ABIs" @
          // https://developer.android.com/ndk/guides/abis.html#sa
          create("arm") {
              ndk.abiFilters += "armeabi"
          }
          create("arm7") {
              ndk.abiFilters += "armeabi-v7a"
          }
          create("arm8") {
              ndk.abiFilters += "arm64-v8a"
          }
          create("x86") {
              ndk.abiFilters += "x86"
          }
          create("x86-64") {
              ndk.abiFilters += "x86_64"
          }
          create("mips") {
              ndk.abiFilters += "mips"
          }
          create("mips-64") {
              ndk.abiFilters += "mips64"
          }
          // To include all cpu architectures, leaves abiFilters empty
          create("all")
      }
  }
  </code></pre>
  
  <p><strong>local.properties</strong></p>
  
  <pre><code>ndk.dir=/Users/vilius/Software/Android/crystax-ndk-10.2.1
  sdk.dir=/Users/vilius/Library/Android/sdk
  </code></pre>
  
  <p>When I try to run the app. I get this error:</p>
  
  <pre><code>....
  :app:generateAllDebugAndroidTestSources UP-TO-DATE
  :app:copyArm64-v8aDebugAllTableair-frameworkSharedLibraryGdbServer UP-TO-DATE
  :app:createArm64-v8aDebugAllTableair-frameworkSharedLibraryGdbsetup
  :app:compileArm64-v8aDebugAllTableair-frameworkSharedLibraryTableair-frameworkMainC UP-TO-DATE
  :app:linkArm64-v8aDebugAllTableair-frameworkSharedLibrary
  /Users/vilius/Software/Android/crystax-ndk-10.2.1/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9/../../../../aarch64-linux-android/bin/ld:     cannot find -lcrystax
  /Users/vilius/Software/Android/crystax-ndk-10.2.1/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9/../../../../aarch64-linux-android/bin/ld:     cannot find -lcrystax
  Error:error: ld returned 1 exit status
  Error:Execution failed for task ':app:linkArm64-v8aDebugAllTableair-frameworkSharedLibrary'.
  &gt; A build operation failed.
        Linker failed while linking libtableair-framework.so.
    See the complete log at: file:///Users/vilius/TableAir/Mobile/app/android-studio-project/app/build/tmp/linkArm64-v8aDebugAllTableair-frameworkSharedLibrary/output.txt    
  </code></pre>
  
  <p>The .../output.txt displays exactly the same information as in the message window.</p>
  
  <p>Does anyone have ideas about this problem?</p>