33954

How to load a library .so file into android application? [closed]

Question:

Can anyone tell me with an .so file given we need to calla jni method in app? The .so file contains implementation methods in C. Thanks in advance.

Answer1:

use this code..

public class NativeLib { static { System.loadLibrary("ndk_demo"); } /** * Adds two integers, returning their sum */ public native int add( int v1, int v2 ); /** * Returns Hello World string */ public native String hello(); }

for more info..<a href="http://marakana.com/forums/android/examples/49.html" rel="nofollow">http://marakana.com/forums/android/examples/49.html</a>

Recommend

  • Java Web Start - load native dependency with another native dependency
  • JNI mapping structure in java
  • NDK: How to reference native sources OUTSIDE Android project?
  • Android: setDataSource IOException happend : java.io.FileNotFoundException: No content provider: htt
  • mupdf for android: ndk-build problem (error: redefinition of typedef…)
  • Error while building android ndk sample project
  • Dynamic library uses statics libraries, undefined symbols appears
  • Copy a file from PDA to PC via USB in java
  • Compile C++ source to a .dll
  • C++ Static Initializer - Is it thread safe
  • how do i know how many clients are calling my WCF service function
  • NewGlobalRef of a weak reference still prevent a object from garbage collected
  • How to use JNI to call a “main” function that takes an array of character pointers?
  • dll not loading in python
  • Singular Value Decomposition Implementation
  • Is it necessary to call system.loadLibrary explicitly for accessing the native methods in a NativeAc
  • How to Divide an array on c#?
  • Is it safe to accept URL parameters for populating the `url_for` method?
  • How to search a CSV file with php by checking if a date falls between 2 ranges
  • Efficient & Pythonic way of finding all possible sublists of a list in given range and the minim
  • Ember.js model to be organised as a tree structure
  • How does document.ready work with angular element directives?
  • ActiveRecord query for a count of new users by day
  • Paperclip, set path outside of rails root folder
  • sending/ receiving email in Java
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • Cannot Parse HTML Data Using Android / JSOUP
  • How to delete a row from a dynamic generate table using jquery?
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Proper folder structure for lots of source files
  • Proper way to use connect-multiparty with express.js?
  • JTable with a ScrollPane misbehaving
  • Java static initializers and reflection
  • How does Linux kernel interrupt the application?
  • unknown Exception android
  • Checking variable from a different class in C#
  • Observable and ngFor in Angular 2
  • failed to connect to specific WiFi in android programmatically
  • Unable to use reactive element in my shiny app
  • How can I use threading to 'tick' a timer to be accessed by other threads?