Call C++ library from Java in Android

前端 未结 4 1002
故里飘歌
故里飘歌 2020-12-28 08:54

Is it possible to call a C++ library from an Android app? If yes, how?

I have zero experience in Android programming (some Java programming experience though) but I

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-28 09:12

    You need to write an Java Native Interface(JNI) to be able to call the native(c/c++) libraries from Android Java code.
    The hierarchy is like:

    +++++++++++++++++++++++++++++++++++        
    |     Android Application         |        
    +++++++++++++++++++++++++++++++++++        
    
    
    +++++++++++++++++++++++++++++++++++  
    |  Android Application Framework  |
    +++++++++++++++++++++++++++++++++++  
    
    
    +++++++++++++++++++++++++++++++++++    
    |     Java Native Interface       |
    +++++++++++++++++++++++++++++++++++
    
    
    +++++++++++++++++++++++++++++++++++
    |      C/C++ Native Libraries     |
    +++++++++++++++++++++++++++++++++++
    

提交回复
热议问题