amyShamna amyShamna - 3 years ago 275
Android Question

How to create jinLib folder to android studio

How to add

jniLib
folder to android studio? I have tried like choosing from right click and select
JNI
folder, but can't able to create!

Answer Source

There is no on-click menu. You can add the jniLibs directory manually. By default, it is app\src\main\jniLibs. You can create this directory in Explorer or your favorite file manager, or from command line (mkdir XXXX\app\src\main\jniLibs will do).

You can create this directory without leaving Android Studio, but for that you must switch from the default Android view to Project:

choosing the view

Now find app/src/main and right click on it and choose New/Directory. Enter jniLibs as new directory name. Click OK.

Note that you can also use a different name for your jniLibs directory (that is, the directory where you can put prebuilt native (JNI) libraries that Android Studio will automatically pack into your APK). You can even have multiple directories recognized by Android Studio. This is controlled in app/build.gradle script:

android { sourceSets { main { jniLibs.srcDirs "src/main/qqq", "abc" }}}

Now, in Project view I see this:

'Project' view

And in Android view the two directories are 'merged':

'Android' view

(I added manually empty files abc.lib and qqq.lib to make it easier to understand what is going on).

To use the jniLibs folder(s), you put there your prebuilt .so files, under ABI subdirectories, e.g.

jniLibs inside

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download