Windows environment teaches you to use Eclipse ADT plugin to generate. h/.so files, Java downgrade with JNI, easy to learn JNI

Source: Internet
Author: User
Tags windows x86

Preparation: Eclipse ADT IDE development tool, NDK, Java environment, Blogger's configuration: Windows x86, ADT build:v22.3.0-887826, Java 1.7, NDK ANDROID-NDK-R9

First we need to know that compiling Project builds under Linux can be done with make, but not in WINDOWS, and that's not much to say, everybody knows

White, but today this blog is to teach you how to configure their own ADT in Windows to develop plug-ins also have such a function, convenient and fast and efficient development, the

Blog is not involved in the Studio so plug-in generation, because bloggers are accustomed to ADT, ready to prepare all the above, we began to carry out the post-stage explanation

① First we create a demo to test whether our configuration was successful

I just created a demo, where Jnitools is called so, before the generation of so, it is recommended not to load so file, the full deletion of the comments

And then start configuring ADT to generate. h files for importing Java Class/method


② After writing this demo class, continue with the following operation, generate the. h file, see the steps below, and configure the requirements




Click on the program again point in the upper left corner of the new, you can see my program under the JAVAH/NDK this is I have been configured, the following continue to teach you to configure

Quick build operation configuration with no command line


Arguments:-classpath ${project_loc}\bin\classes-d ${project_loc}\jni-jni ${java_type_name}


After configuring the Common


Every time you change the configuration remember to apply, the. h file generated configuration is OK, the following is the use of the generated operation


The resulting file


The generation of the header file is complete, and it's down to writing a. c file and configuring the. So file-generated plug-in


Write the. c file as above, import the header files and methods that we generated earlier, and start building the. So configuration plug-in, similar to the Javah configuration, but before that we need to configure application.mk/ Android.mk file, if the APPLICATION.MK is not configured, the default compilation Android.mk file, write the following andriod.mk file, before we can not go to understand the two MK file variables in the end what is the role, specifically for what to do, after the configuration can go back to learn more about



② to start configuring the plug-in for ADT to generate. so files








Don't forget to apply, continue to say below. Generation of SO



Call and test for so:



The entire configuration here is finished, the following talk about so some of the anti-compilation skills, which is actually a technical work, I believe that contact JNI friends know that

This is not easy, because even if parsed out, but also some assembly language, but also need to continue to deepen in order to obtain the fundamental meaning of the necessary things

Here, bloggers recommend a so-decompile tool, IDA, which I think is the best tool for reverse so far







All in all, a more than a function of so reverse up is very cumbersome and heavy workload of the project, hey, of course, as long as there is interest to do it is not difficult, like me, nothing like to delve into these gadgets

Well, this blog is so much content, you can slowly try to figure out

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Windows environment teaches you to use Eclipse ADT plugin to generate. h/.so files, Java downgrade with JNI, easy to learn JNI

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.