0

A C++ library which was converted to .AAR (Not by me) to use with Android Studio . I was able to add the aar file inside lib folder and was able to sync successfully using gradle .

I am well aware that c++ library can be only accessed threw JNI . Unfortunate, i cant find any of C++ lib functions to include in JNI .

I am new to C++ lib integration . The arr file contains 8 .SO files

project level

      repositories {
    jcenter()
    flatDir{
        dirs 'libs'
    }
}

app level

    compile(name:'oxy', ext:'aar')

Any suggestion or help is appreciated .

Nikhil
  • 911
  • 15
  • 28

1 Answers1

0

While converting the .so files to aar, the author must have also written java code wrappers which actually implement the JNI interfacing. The intent would definitely be to make access to native code easier using the wrapper java classes. You could just extract the aar file using any unzipping tool and see if there is a classes.jar file. If yes, you could either decompile the .class files and see the java code (if code is not obfuscated) or you could talk to the author to get details on how to use the java classes.

Srikanth
  • 56
  • 6
  • So JNI is not enough for accessing the library right ? – Nikhil Oct 27 '17 at 05:38
  • Yes you/author of the .so files must write JNI layer in java and make calls to native code and vice versa. JNI is basically a glue layer to interface with native code. – Srikanth Oct 27 '17 at 09:51
  • @Nikhil Please accept the answer if your query is resolved. – Srikanth Oct 30 '17 at 07:20
  • After reading your answer i went threw Google and found this https://github.com/commonsguy/cwac-anddown . In this github sample i found they were using both JNI and Java class to create library . Please have a look and let me know whether my assumptions were right – Nikhil Oct 30 '17 at 10:17