NDK support is an experimental features and all use cases are not yet supported error in Android Studio?
android, android-ndk, android-studio, c++, java
Solution
Here's the solution:
Update your Android Studio to either the latest version or to the latest public pre-release version.
Android Studio 2.2.1 is currently the latest version and it has proper C++ support build in. They're still working on it and some things might still be unsupported, but using C++ is definetly working better on a newer version. Ofcourse also make sure to keep your Android SDK up to date.
Problem
I want to integrate NDK into Android studio but i am facing NDK support is an experimental feature and use cases are not yet supported error.I have downloaded NDK using the SDK manager and the NDK is palced C:\Users\The\AppData\Local\Android\Sdk\ndk-bundle. I have also created NativePanorama java class for Java and C++ interaction. Here is the code for the NativePanorama.java class ``` public class NativePanorama { public native static void processPanorama(long[] imageAddressArray, long outputAddress); { } } ``` I used the javah command in the terminal to create the corresponding C++ header for the processPanorama method in the NativePanorama java class. Here is the created com_example_the_myapplication_NativePanorama.h c++ header file. ``` /* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class com_example_the_myapplication_NativePanorama */ #ifndef _Included_com_example_the_myapplication_NativePanorama #define _Included_com_example_the_myapplication_NativePanorama #ifdef __cplusplus extern "C" { #endif /* * Class: com_example_the_myapplication_NativePanorama * Method: processPanorama * Signature: ([JJ)V */ JNIEXPORT void JNICALL Java_com_example_the_myapplication_NativePanorama_processPanorama (JNIEnv *, jclass, jlongArray, jlong); #ifdef __cplusplus } #endif #endif ``` Here is also the com_example_the_myapplication_NativePanorama.cpp c++ source file. ``` #include "com_example_panorama_NativePanorama.h" JNIEXPORT void JNICALL Java_com_example_panorama_NativePanorama_processPanorama (JNIEnv * env, jclass clazz, jlongArray imageAddressArray, jlong outputAddress){ } ``` May be the error is in the build.gradle file here is my build.gradle(app) file ``` import org.apache.tools.ant.taskdefs.condition.Os apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.3" defaultConfig { applicationId "com.example.the.myapplication" minSdkVersion 19 targetSdkVersion 23 versionCode 1 versionName "1.0" } // begin NDK OPENCV sourceSets.main { jni.srcDirs = [] //disable automatic ndk-build call } task ndkBuild(type: Exec, description: 'Compile JNI source via NDK') { def rootDir = project.rootDir def localProperties = new File(rootDir, "local.properties") Properties properties = new Properties() localProperties.withInputStream { instr -> properties.load(instr) } def ndkDir = properties.getProperty('ndk.dir') if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine "$ndkDir\\ndk-build.cmd", 'NDK_PROJECT_PATH=build/intermediates/ndk', 'NDK_LIBS_OUT=src/main/jniLibs', 'APP_BUILD_SCRIPT=src/main/jni/Android.mk', 'NDK_APPLICATION_MK=src/main/jni/Application.mk' } else { commandLine "$ndkDir/ndk-build", 'NDK_PROJECT_PATH=build/intermediates/ndk', 'NDK_LIBS_OUT=src/main/jniLibs', 'APP_BUILD_SCRIPT=src/main/jni/Android.mk', 'NDK_APPLICATION_MK=src/main/jni/Application.mk' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.4.0' compile project(":opencv-java") } ``` There is also Reports native method declaration in java where no corresponding jni function is found in the project error in the NativePanorama.java class. How can i fix those problem?