Android multi jni modules [gradle]

I would like to know how to modify build.gradle to make multiple modules ( ndk{moduleName}

) from selected files *.c

. Has anyone done this before? Is it possible?

Let's say I have two classes:

public ClassA {
   static { 
      System.loadLibrary("ClassAlib") 
   }

   public native int funcA();
}

public ClassB {
   static { 
      System.loadLibrary("ClassBlib") 
   }

   public native int funcA();
}

      

For both, I created jni headers and created .c files in the src / jni folder. How do I modify my build.gradle file to make two libraries instead of one?

+3


source to share


1 answer


I think you can use two options for build.grade:



sourceSets {
    main {
        jni.srcDirs = [<location for each module>] 
        jniLibs.srcDir '<location for so file>'
    }
}

      

0


source







All Articles