Android Native Code development and learning (1)
This tutorial is for native code study notes. I hope it can help those in need.
My computer system is Ubuntu 22.04. Of course, Windows is also available. There is not much difference.
Environment configuration
First we create a new native C++ project
Then we download NDK and CMake
Note that sometimes after we download it, it will still show that there is no NDK, that is, there will be a null pointer error. In this case, we need to manually specify the NDK directory. If this does not happen, please ignore it. Two manual specification methods are introduced below.
NDK specification method one (it seems there is a bug and sometimes it cannot be used)
Directly select the NDK location below, but most of the time it is gray and cannot be modified. I don’t know if this is a bug or just like this, so it is recommended to use the next method directly.
NDK specification method two
Modify the path directly in local.properties. If there is no ndk.dir, you can add it manually.
Then we can sync again. If you don’t know what sync is, the picture above
It’s this cute elephant. Elephant, why is your trunk so long~
Then we click to run
Note that there may be a problem asking you to download the latest build tool, just follow its prompts to download it.
This is a blog I wrote a long time ago. Now I am reviewing the technology and re-improving the blog. I hope it can help you.