Corresponding configuration between C/C++ and cmake in JNI

I have read a lot of JNI web pages recently, basically all of them are JNI environment configuration, and then there is no more, Android studio to the 3.0 version of the environment is dead, the initialization has a basic file native-lib.cpp, run You can display the string returned from C++ on the interface. I won't introduce this here today, there are too many. It doesn't make any sense at all.


Today's main introduction:

1. How to add a separate file in C language

2, Build between cmake and C/C++

Create a new C language file (of course you can also create a new C++ file):

write picture description here
write picture description here

After the new creation is completed here, we can write code here, or we can call it according to the method name in the activity

Introduction to Cmake files (many junior JNI programmers don't know how to read cmake files, and the Internet teaches people how to configure the JNI environment)

write picture description here

Remarks, if there is anything wrong with the above, please correct me and learn and progress together!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325577459&siteId=291194637