Steps to package JNI-generated so into jars in eclipse

Source: Internet
Author: User

Description: New, not familiar with Java, forgive me.

1. New project, add good native support, write the corresponding file (including CPP file, so file and corresponding Java file, this is called the corresponding Java file is Sojar.java,).

2. Right-click the Sojar.java file, select Export, and select Jar file in Java.

Then set the path, all the way to finish. The corresponding jar file can be generated.

3. Put the generated Sojar.jar file into the new project's Libs directory (the old version of the possible steps is more complex, I use the Eclipse 23, do not need any other settings, directly into the line), put the libsojar.so file into the libs\ Armeabi directory (or the corresponding directory).

4. Write the code normally.

Sojar.somecode ();

  

Problem: One problem is that if you use the original so, you need 2s; if you use a jar package, you need 8s. For the time being, it is unclear why the speed gap is so large.

Main references:

Http://stackoverflow.com/questions/24773153/the-library-javacv-android-arm-jar-contains-native-libraries-that-will-not-run

Steps to package JNI-generated so into jars in eclipse

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.