<span id="Label3"></p><p><p><strong>This is my first time to write a blog please take care</strong></p></p><p><p>The first contact to the Android NDK is really a mask because it needs to be in touch with a Bluetooth slave, so you set up the CPP algorithm in your project and then summarize the steps Androidstudio uses the Ndk:</p></p><p><p><br></p></p><p><p>1 <span style="color:rgb(37,37,37); font-family:tahoma,arial,宋体; font-size:14px; line-height:28px; text-indent:28px">Tools and resources Needed:</span></p></p><p><p><span style="color:rgb(37,37,37); font-family:tahoma,arial,宋体; font-size:14px; line-height:28px; text-indent:28px">Development tools ANDROIDSTUDIO,NDK Development toolset, No network download, I use Android studio1.5.1 and android-ndk-r10, of course, and I do not have the same, Android studio1.3 began to support DNK development;</span></p></p><p><p><span style="color:rgb(37,37,37); font-family:tahoma,arial,宋体; font-size:14px; line-height:28px; text-indent:28px"><br></span></p></p><p><p><span style="color:rgb(37,37,37); font-family:tahoma,arial,宋体; font-size:14px; line-height:28px; text-indent:28px">2 Importing the NDK</span></p></p><p><p><span style="color:rgb(37,37,37); font-family:tahoma,arial,宋体; font-size:14px; line-height:28px; text-indent:28px"></span></p></p><p><p><br></p></p><p><p>3 <span style="color:rgb(37,37,37); font-family:tahoma,arial,宋体; font-size:14px; line-height:28px; text-indent:28px">Set the path to the NDK in the local.properties file:</span></p></p><p><p><span style="color:rgb(37,37,37); font-family:tahoma,arial,宋体; font-size:14px; line-height:28px; text-indent:28px"><br></span></p></p><p><p><span style="color:rgb(37,37,37); font-family:tahoma,arial,宋体; font-size:14px; line-height:28px; text-indent:28px"><br></span></p></p><p><p><span style="color:rgb(37,37,37); font-family:tahoma,arial,宋体; font-size:14px; line-height:28px; text-indent:28px">4 You can then program the NDK using the</span></p></p><p><p><span style="color:rgb(37,37,37); font-family:tahoma,arial,宋体; font-size:14px; line-height:28px; text-indent:28px">First create a class project</span></p></p><p><p><span style="color:rgb(37,37,37); font-family:tahoma,arial,宋体; font-size:14px; line-height:28px; text-indent:28px"><br></span></p></p><p><p><span style="color:rgb(37,37,37); font-family:tahoma,arial,宋体; font-size:14px; line-height:28px; text-indent:28px">5 Generating header files for this class</span></p></p><p><p><span style="color:rgb(37,37,37); font-family:tahoma,arial,宋体; font-size:14px; line-height:28px; text-indent:28px">Ps: in androidstudio, It is self-contained command Function.</span></p></p><p><p><span style="color:rgb(37,37,37); font-family:tahoma,arial,宋体; font-size:14px; line-height:28px; text-indent:28px"></span></p></p><p><p><span style="font-size:14px; line-height:28px; color:rgb(37,37,37); font-family:tahoma,arial,宋体; text-indent:28px">6 Input Statement Generation header file</span></p></p><p><p><span style="font-size:14px; line-height:28px; color:rgb(37,37,37); font-family:tahoma,arial,宋体; text-indent:28px">Switch to main road strength</span></p></p><p><p><span style="font-size:14px; line-height:28px; color:rgb(37,37,37); font-family:tahoma,arial,宋体; text-indent:28px"><br></span></p></p><p><p><span style="font-size:14px; line-height:28px; color:rgb(37,37,37); font-family:tahoma,arial,宋体; text-indent:28px">7 You can see if a header file was generated in build</span></p></p><p><p><span style="font-size:14px; line-height:28px; color:rgb(37,37,37); font-family:tahoma,arial,宋体; text-indent:28px"><br></span></p></p><p><p><span style="font-size:14px; line-height:28px; color:rgb(37,37,37); font-family:tahoma,arial,宋体; text-indent:28px"><br></span></p></p><p><p><span style="font-size:14px; line-height:28px; color:rgb(37,37,37); font-family:tahoma,arial,宋体; text-indent:28px">8 If you create a success in the JNI directory, the header file will be Generated. h then create your own C + + file by yourself, write the C + + file referenced in the header, and the code you need in c;</span></p></p><p><p><span style="font-size:14px; line-height:28px; color:rgb(37,37,37); font-family:tahoma,arial,宋体; text-indent:28px"><br></span></p></p><p><p><span style="font-size:14px; line-height:28px; color:rgb(37,37,37); font-family:tahoma,arial,宋体; text-indent:28px"><br></span></p></p><p><p><span style="font-size:14px; line-height:28px; color:rgb(37,37,37); font-family:tahoma,arial,宋体; text-indent:28px"><br></span></p></p><p><p><span style="font-size:14px; line-height:28px; color:rgb(37,37,37); font-family:tahoma,arial,宋体; text-indent:28px"><br></span></p></p><p><p><span style="font-size:14px; line-height:28px; color:rgb(37,37,37); font-family:tahoma,arial,宋体; text-indent:28px">9 finally configured in Build.gradle</span></p></p><p><p><span style="font-size:14px; line-height:28px; color:rgb(37,37,37); font-family:tahoma,arial,宋体; text-indent:28px"><br></span></p></p><p><p><span style="font-size:14px; line-height:28px; color:rgb(37,37,37); font-family:tahoma,arial,宋体; text-indent:28px">10 finally initialized in Build->make Project</span></p></p><p><p><span style="font-size:14px; line-height:28px; color:rgb(37,37,37); font-family:tahoma,arial,宋体; text-indent:28px"><br></span></p></p><p><p><span style="font-size:14px; line-height:28px; color:rgb(37,37,37); font-family:tahoma,arial,宋体; text-indent:28px">If you don't have a compilation error, you're a success Teenager. There are also Androidstuido are automatically generated MK files that you do not need to create</span></p></p><p><p><span style="font-size:14px; line-height:28px; color:rgb(37,37,37); font-family:tahoma,arial,宋体; text-indent:28px"><br></span></p></p><p><p>Androidstudio How to use JNI</p></p></span>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service