Hello-JNI for Android Studio

I just started working with NDK and am struggling to get a Hello-JNI sample running on Android Studio. I worked with Eclipse, but I would prefer it to work in Android Studio. I spilled countless suggestions on how I should put the armeabi folder in the lib folder and pack it in a jar ( https://groups.google.com/forum/#!msg/adt-dev/nQobKd2Gl_8/Z5yWAvCh4h4J ), but nothing yet of this worked. This is getting rather unpleasant. Does anyone have a working Hello-JNI sample that you can create and run from Android Studio and deploy to your device? I just need a working NDK sample in Android Studio. Any help is appreciated, thanks guys.

+7
java android eclipse android-studio android-ndk
source share
3 answers

According to Google, Android Studio will start supporting NDK projects in it version 5.0 (I can’t find the source, but I will add it as soon as I get it). At the moment, the latest version is 3.1.

You can find a couple of workarounds for this thread.

+2
source share

It worked, it is from Intel and is a bit dated, but it works.

https://software.intel.com/en-us/videos/using-the-ndk-with-android-studio

0
source share

First, you need Android Ndk, download it. you need to add android ndk to your project, so go to windows β†’ Preference β†’ Ndk β†’ and it looks at your ndk path here.

After that, create one project for Android and right-click on the project and go to add built-in support, it will automatically create one .so file.

Just clean and create your project, including everything you need for ndk development.

Now create a nativ method in your activity and generate the header file using the javah command corresponding to the activity.

-2
source share

All Articles