In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
It is believed that many inexperienced people have no idea about how to build NDK environment in Android. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
What is NDK?
NDK, known as Native Development Kit, is an Android toolkit that helps developers quickly develop dynamic libraries for C (or C++) and automatically package so and java applications into apk. These tools are of great help to developers.
NDK integrates cross-compilers and provides corresponding mk files to isolate CPU, platform, ABI and other differences. Developers only need to simply modify the mk file (indicating "which files need to be compiled", "compilation feature requirements", etc.) to create a so.
NDK can automatically package so and Java applications together, which greatly reduces the packaging work of developers.
In Android development, the demand for using NDK development is gradually increasing
But many people don't understand what's going on between JNI and NDK.
Today, I will first introduce the difference between JNI and NDK &, teaching the use of NDK hand in hand. I hope you will like it.
JNI is mentioned again from what is mentioned above, so what is JNI?
The full name of JNI is Java Native Interface, that is, Java local interface. Its actions enable Java to interact with other native types of languages, such as C, C++.
The relationship between NDK and JNI
Environment configuration of Android Studio NDK
The version of Android Studio I use is 3.3.2
Open SDK Manager in the upper toolbar
Then we click on SDK Tools
After entering, LLDB, CMAKE and NDK are all checked to download and install.
Create a new NDK project
Click Start a new Android Studio project
Find the last item called Native clocking, and then click Next.
Note: before, you can directly select the empty Acitivty, and then there is an option to check include C++. This change was also found later, and I was confused at the beginning.
Enter a Name as vaccaendk, and then click Next
If you choose the C++ version, you can choose Candles11, which is fine by default here. Click Finish to create the project
The created project can be seen from the following figure. There is an extra CPP package on the left with CMakeList.txt and native-lib.cpp files in it. In the default MainActivity, you can see that the right red box refers to the library name named native-lib. Here is a demo example of stringFromJNI.
Let's take a look at native-lib.cpp again.
After reading the above, have you mastered how to build a NDK environment in Android? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.