search

Home  >  Q&A  >  body text

java - Android calls c++lib

Asked before. But I lost my account number so I am asking again.
Requirements: Android platform adjusts c lib.
1.c Part of the source code already exists and needs to be compiled into a lib. How to compile it into an Android lib. This part c needs to be compiled together with caffe and opencv lib.
2. How to adjust Android calls.

滿天的星座滿天的星座2772 days ago1896

reply all(2)I'll reply

  • 学习ing

    学习ing2017-07-06 10:39:09

    1. Knowledge content of android ndk. The existing c++ source code may not be directly compiled. The characteristics of the android platform must be considered, especially where jni calls are required, the jvm pointer needs to be specified; compilation involves the makefile of the android platform, which is not good. To make it clear in one or two sentences, for integrating and linking caffe&opencv, there are static libraries and shared libraries, which require deeper ndk professional knowledge. I recommend a book to you "Pro Android C++ with the NDK"
    2. Android The call is a jni call, which will also be covered in the above book.
    I wish you success!

    reply
    0
  • typecho

    typecho2017-07-06 10:39:09

    For Android to call C++ code, the C++ code needs to be compiled into a .so library file to call. You can check the relevant knowledge: JNI, Android NDK.
    The following article is relatively basic, you can practice it first by following the steps in it.
    android studio compiles C to generate .so file

    reply
    0
  • Cancelreply