简体   繁体   English

将C ++ AAR库添加到Android Studio中?

[英]Adding a C++ AAR library into Android Studio?

A C++ library which was converted to .AAR (Not by me) to use with Android Studio . 一个C ++库,已转换为.AAR (不是我本人),可与Android Studio一起使用。 I was able to add the aar file inside lib folder and was able to sync successfully using gradle . 我能够在lib文件夹中添加aar文件,并能够使用gradle成功同步。

I am well aware that c++ library can be only accessed threw JNI . 我很清楚,只能通过JNI访问c ++库。 Unfortunate, i cant find any of C++ lib functions to include in JNI . 不幸的是,我找不到要包含在JNI中的任何C ++ lib函数。

I am new to C++ lib integration . 我是C ++ lib集成的新手。 The arr file contains 8 .SO files arr文件包含8个.SO文件

project level 项目层面

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

app level 应用程序级别

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

Any suggestion or help is appreciated . 任何建议或帮助表示赞赏。

While converting the .so files to aar, the author must have also written java code wrappers which actually implement the JNI interfacing. 在将.so文件转换为aar的同时,作者还必须编写实际实现JNI接口的Java代码包装器。 The intent would definitely be to make access to native code easier using the wrapper java classes. 目的肯定是使用包装Java类简化对本机代码的访问。 You could just extract the aar file using any unzipping tool and see if there is a classes.jar file. 您可以使用任何解压缩工具来提取aar文件,然后查看是否存在classes.jar文件。 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. 如果是,则可以反编译.class文件并查看Java代码(如果未混淆代码),或者可以与作者联系以获取有关如何使用Java类的详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM