ant ant - 1 year ago 85
Android Question

Generate C header file (*.h) for native method implementation JNI in android studio

How to generate C header file (*.h) containing the function prototype for the native method implementation JNI in Android studio while build automatically?

Thank You

Answer Source

Assume you have a project HelloNative

   |-build/intermediate/classes/debug  (you get this directory upon project build)

And you want to generate the header file for --> do this

cd HelloNative

javah -d app/src/main/jni -classpath /Users/john-smith/Android/sdk/platforms/android-19/android.jar:app/build/intermediates/classes/debug com.planets.mercury.HelloNativeActivity

Replace john-smith and android sdk path with what it is on your own machine. For the android jar file. You can use whatever is your choice.

Eg. android-19, or android-21

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download