I am very new to this whole gradle and Android Studio support. I have managed to convert my android project to gradle using the export option.
But I am looking for some documentation or start point how to integrate the NDK build into the gradle build process.
If possible I also need some sort of "after" stage that copies the build binaries (.so files) to the asset directory.
If your project exported from eclipse,add the codes below in gradle file:
2.If you create a project in Android studio:
create a folder named jniLibs in src/main/ ,and put your *.so files in the jniLibs folder.
And copy code as below in your gradle file :
An elegant workaround is shown in https://groups.google.com/d/msg/adt-dev/nQobKd2Gl_8/Z5yWAvCh4h4J.
Basically you create a jar which contains "lib/armeabi/yourlib.so" and then include the jar in the build.
I have used
ndk.dir=/usr/shareData/android-ndk-r11b
// path of ndkin local.properties file in android studio project. and add this line :
android.useDeprecatedNdk=true
in gradle.properties file in android studio project.
More information here: http://tools.android.com/tech-docs/android-ndk-preview
configure project in android studio from eclipse: you have to import eclipse ndk project to android studio without exporting to gradle and it works , also you need to add path of ndk in local.properties ,if shows error then add
in build.gradle file then create jni folder and file using terminal and run it will work
now.I can load the so success!
1.add the .so file to this path
|--src |--|--main |--|--|--java |--|--|--jniLibs |--|--|--|--armeabi |--|--|--|--|--.so files
2.add this code to gradle.build
}
3.
System.loadLibrary("yousoname");