Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio "Current NDK support is deprecated"

Tags:

As of Jan 2015 the NDK support for Android studio is still unusable. A cryptic message says: "Alternative will be provided in the future."

I'd like to know what's gradle/google direction on this is since it's impossible to plan a proper development plan at the moment.

Version 0.7+: They suggested to still use ndk-build / ant Version 0.8+: They've introduced a minimal NDK support Version 1.0.0: It looked like NDK support was going to be official Version 1.0.2: It now looks like NDK support is deprecated.

My questions are:

  • Is everyone reverting to ndk-build and hand made android.mk files?

  • Is anyone using the currently deprecated method on 1.0.0+ (gradle ndk support) on a serious size project?

  • What sort of direction the "Alternative will be provided in the future" would go? Is is possible for any insider to answer that without breaking any company rules?

Edit: it's not a duplicate because it was referring to the evolution of Android Studio and NDK, the other question refers to a very ancient version of Android Studio as I've detailed in my post the NDK support has changed drastically from version to version without a clear direction, up to now with the release of 1.3

like image 393
Dado Avatar asked Jan 27 '15 16:01

Dado


2 Answers

Update from Google I/O 2015

Android Studio v1.3 Preview - We are releasing a new version of Android Studio. Most notable is a much requested feature from our Android NDK & game developers: code editing and debugging for C/C++ code. Based on JetBrains Clion platform, the Android Studio NDK plugin provides features such as refactoring and code completion for C/C++ code alongside your Java code. Java and C/C++ code support is integrated into one development experience free of charge for Android app developers. Update to Android Studio v1.3 via the Canary channel and let us know what you think.

Source from android developers blog here.


New Update 30/7/2015 -> Android Studio v1.3 Released

As a part of the Android 1.3 stable release, we included an Early Access Preview of the C++ editor & debugger support paired with an experimental build plugin. See the Android C++ Preview page for information on how to get started. Support for more complex projects and build configurations is in development. enter image description here

Quoted from android developers blog here.

Added Features:

  • Code completion
  • Code navigation (go to declaration, jump between header and implementation, etc)
  • Quick fixes
  • Intentions
  • Refactoring
  • Source format
  • Debugging
  • ...

For steps on how to use it, look here.

like image 188
Ahmed Hegazy Avatar answered Sep 20 '22 10:09

Ahmed Hegazy


I invoke the command line, not sure where I got this from, it's basically your first option, reverting to ndk-build with hand made android.mk. Fine if you don't want to control ndk abiFilters by product flavour.

apply plugin: 'com.android.library'  android {     compileSdkVersion rootProject.ext.compileSdkVersion     buildToolsVersion rootProject.ext.buildToolsVersion      defaultConfig {         minSdkVersion rootProject.ext.minSdkVersion         targetSdkVersion rootProject.ext.targetSdkVersion          ndk {             moduleName "glues"         }     }      sourceSets.main {         jniLibs.srcDir 'src/main/libs' //set .so files location to libs         jni.srcDirs = [] //disable automatic ndk-build call     }      task buildNative(type: Exec, description: 'Compile JNI source via NDK') {         def ndkDir = android.ndkDirectory         commandLine "$ndkDir/ndk-build",                 '-C', file('src/main/jni').absolutePath, // Change src/main/jni the relative path to your jni source                 '-j', Runtime.runtime.availableProcessors(),                 'all',                 'NDK_DEBUG=1'     }      task cleanNative(type: Exec, description: 'Clean JNI object files') {         def ndkDir = android.ndkDirectory         commandLine "$ndkDir/ndk-build",                 '-C', file('src/main/jni').absolutePath, // Change src/main/jni the relative path to your jni source                 'clean'     }      clean.dependsOn 'cleanNative'      tasks.withType(JavaCompile) {         compileTask -> compileTask.dependsOn buildNative     }      buildTypes {         release {             minifyEnabled false             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'         }     } }  dependencies { } 

I only see those warnings if I setup abiFilter on the productFlavors:

productFlavors {     x86 {         ndk {             abiFilter "x86"         }     }     mips {         ndk {             abiFilter "mips"         }     }     armv7 {         ndk {             abiFilter "armeabi-v7a"         }     }     arm {         ndk {             abiFilter "armeabi"         }     }     fat } 

Note, older gradle plugin versions used android.plugin.ndkFolder rather than android.ndkDirectory. For more info, see: http://tools.android.com/tech-docs/new-build-system/migrating-to-1-0-0

like image 24
weston Avatar answered Sep 20 '22 10:09

weston