Call JNI function in Android Studio link for download


Xem Thêm Bài Viết Khác:



  1. Bharat Bohara Reply

    I have been going through your since a week. I am having problem with ndk-bundle adressing? I am using Linux. I just copied all the, and portion for app:gradle.bundle. How can I compile your code on linux? I have been getting this error: "Process 'command '/home/username/Android/Sdk/ndk-bundle/ndk-build'' finished with non-zero exit value 2".

  2. Hey kindly help me, I follow your instructions and create build. But it didn't create classes directory in build.intermediates folder ?

  3. Thanks for your great tutorial! But using .mk is old, and I think using CMake should be encouraged more now.

  4. argen adenov Reply

    Anyone please can help with this error Process 'command '/Users/argenadenov/Library/Android/sdk/ndk-bundle/ndk-build''f inished with non-zero exit value 2

  5. jinyang huang Reply

    Hi, the classes folder is not generated by itself. What am I supposed to do then

  6. Besh PRAKASH12 Reply

    when i put "OPENCVROOT:=C:/Users/my_username/Documents/Android/OpenCV-android-sdk




    include ${OPENCVROOT}/sdk/native/jni/" I get problem
    Process 'command 'C:/Users/my_username/AppData/Local/Android/sdk/ndk-bundle/ndk-build.cmd'' finished with non-zero exit value 2

  7. ulis diron Reply

    Can I know which version of Java you are using? I use java 10 but can't find javah, but only javac. Thanks sir.

  8. Gautam Gelani Reply

    it will show me error like this what can i do?

    E/AndroidRuntime: FATAL EXCEPTION: main
    Process:, PID: 24975
    java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/", zip file "/data/app/", zip file "/data/app/", zip file "/data/app/", zip file "/data/app/", zip file "/data/app/", zip file "/data/app/", zip file "/data/app/", zip file "/data/app/", zip file "/data/app/", zip file "/data/app/", zip file "/data/app/"],nativeLibraryDirectories=[/data/app/, /vendor/lib, /system/lib]]] couldn't find ""
    at java.lang.Runtime.loadLibrary(
    at java.lang.System.loadLibrary(
    at java.lang.Class.newInstance(Native Method)
    at android.os.Handler.dispatchMessage(
    at android.os.Looper.loop(
    at java.lang.reflect.Method.invoke(Native Method)

  9. Subha Ananth Reply

    These are great videos! I am a little stuck all the steps worked out and built and generated the, but when it runs on the phone i get NDKTest has stopped, any suggestions?

  10. how to configure javah in cmd, anybody could help me I could not find it in my pc.
    I am using windows 10


    I cant find the in the 3.1.0 android version. How can I fix it?

  12. at 13:29, I have Error:(49) src/main/jni/ No such file or directory

  13. hello sir. the tutorial is great. can you help me! i did't find ndk-build.cmd in command prompt. but when i direct it to the directory of ndk-build its working fine. i follow the tutorial. when i build the project by adding task ndk-build in build gradle i find an error that ndk-build.cmd finished with non-zero exit value 2. please help me to get out of it.

  14. I found my code error by using ndk-build in terminal and not in build.gradle file and that shown my error(in windows)
    my mean is something like this in terminal:
    ndk-build.cmd NDK_PROJECT_PATH=build/intermediates/ndk NDK_LIBS_OUT=G:/mydir/Android/Projects/projectName/app/src/main/jniLibs APP_BUILD_SCRIPT=G:/mydir/Android/Projects/projectName/app/src/main/jni/ NDK_APPLICATION_MK=G:/mydir/Android/Projects/projectName/app/src/main/jni/
    im not sure that this way can be used instead of that gradle way but at least can be used for checking that our cpp code has error or not!

  15. Michael Melatti Reply

    Gradle build finishes but no .so file. how can I test that the ndkBuild commandLine is working?

  16. Sir, please upload some ndk videos on Media Framework. A basic one. An idea on how to work on HAL

  17. Mohamed Slama Reply

    for linux users :
    first you have to install (ndk & cmake & lldb)
    second the file ndk-build.cmd name is [ndk-build] will found in ~/Android/Sdk/ndk-bundle/ndk-build or where you installing ndk

  18. Erangi Ariyasena Reply

    hello I'm following your great tutorials.but I've some issue in generating header file.the header file is successfully generating but JNIEXPORT void JNICALL(//parameters); function is not generated automatically. I tried defining it myself but it gave me errors.any clue about what's wrong with that? I can't proceed with the tutorials because of this. Please help me.thanks in advance

  19. I can't call ndk-build.cmd at any location. It just can be called at its path. Is that OK? If not, how can I fix that?

  20. Dipankar Sinha Sarkar Reply

    Do we need to install NDK before doing this tutorial?

  21. Игорь Хоменко Reply

    Hello, thanks so much for your videos. But i got a problem.
    Error: cannot access
    class file for not found

  22. abobakar ahmad Reply

    it's great tutorials , sir i have a question that how to return mat
    object from jni side to java and if we want to return more than one mat
    object to java how would i do that.

  23. Error:Execution failed for task ':app:ndkBuild'.
    > A problem occurred starting process 'command 'C:Usersmarcinb.androidndk-bundle.cmd''

  24. Kalvin Krishna Reply

    I also get problem on Native Java Class that the function is not corresponding to JNI Function how should i fixed that? thank you

  25. suman neupane Reply

    Error:Execution failed for task ':app:ndkBuild'. > Process 'command 'C:/Users/suman/AppData/Local/Android/sdk/ndk-bundle/ndk-build.cmd'' finished with non-zero exit value 2

  26. Nisarg Solanki Reply

    Hi dtdzung, Thanks for These tutorials..I followed your tutorials but I got an Error of 'Android NDK: WARNING:There are no modules to build in this Project!' …..Could you help me please.. I am using Android 2.2.3 ….Thanks in Advance. 🙂

  27. Larissa Cardoso Zimmermann Reply

    I have this issue: "Can't resolve type JNIEXPORT". How can I solve this issue?

  28. Ishdorj Idree Reply

    Hi, thanks so much your video. I run the app on device, gives me message "Unfortunately, NDKTest has stopped" please help me

  29. Barbie swan Reply

    Hi. I'm having issue. JniLibs folder isn't created although my project showing no error. I'm using 2.2.1 version of android studio. Please help me to solve this. Thanks in advance.

  30. Muhammad Zeshan Reply

    sir.. please help me..i have problem that…javah file not found..what we do… ? when we Test and write command in console so console give me an error "'javah' is not recognized as an internal or external command,
    operable program or batch file.

    sir please help me..i will very thankful to you…if you help me..thanks

  31. Usman Arshad Reply

    Hi Mr.dtdzung
    Thanks for the great tutorial but sir i'm facing a problem I did everything you do but it says
    Error:(198) * Android NDK: Aborting… . Stop.
    please help.
    Thanks in advance.

  32. Usman Ishtiaq Raja Reply

    ndk-build.cmd not working
    my ndk is placed in E directory but when i run the command in cmd it says command is not recognized please help how to setup environment for ndk .

  33. Luqman Naim Reply

    Hi, i followed all your steps until the end. Compiled the code and got no errors, but the app crashes on my phone. I think it has something to do with the CPU structure for a different device? I am using Nexus 5X btw.

  34. AbegaileGuia Bagtas Reply

    hello Mr.dtdzung, i am very thankful for your tutorial but i cant proceed to this one because i can't find the javah in my unit (well i really don't know what is javah) i hope you can help me with this thank you so much

  35. Anmol Kohli Reply

    Hey dtdzung amazing tutorial. I wanted to ask can we somehow call the header files of the opencv in the path OpenCV-android-sdksdknativejniincludeopencv2 into our own project somehow ?

  36. Hi. I've already set the java environment variables but it still not recognized.

  37. Hi! First, thanks for the great tutorials !
    I have two errors when I try to build the project:
    (please notice that I have javah working properly and ndk-build.cmd just like you showed )
    first error:

    Error:error: assembler command failed with exit code 1 (use -v to see invocation)

    second error:
    Error:Execution failed for task ':app:compileDebugNdk'.
    > org.gradle.process.internal.ExecException: Process 'command 'C:UsersAppDataLocalAndroidsdkndk-bundlendk-build.cmd'' finished with non-zero exit value 2

    could you please help me? thanks!

  38. Kevin Historia Reply

    nice tutorial dtdzung, but i want to ask. i got an error when i rebuild my grade on 12:51 mins. after i paste the code from your dropbox. i already change the ndk directory and searching for some solution on internet but still got the same error.

    Error:Execution failed for task ':app:ndkBuild'.
    > Process 'command 'C:/Users/NOTEBOOK/AppData/Local/Android/sdk/ndk-bundle/ndk-build.cmd'' finished with non-zero exit value 2

    got any ideas why??

  39. RokCombat Airsoft Reply

    Hi dtdzung, i have a problem with include jni.h, maybe you add a variable in system for exemple on path? This weekend i add you contact on my skype, ok,?But if you can please contact with me on this comment. Congrats, nice videos.

  40. I am also having the problem: Error:Execution failed for task ':app:ndkBuild'.
    > Process 'command 'C:/Users/jjww/AppData/Local/Android/sdk/ndk-bundle/ndk-build.cmd'' finished with non-zero exit value 2
    I've looked online for answers but no solutions have seemed to work so far. any help would be appreciated!

  41. Thank you for your wonderful video. I am having a problem with create " classes", it shows the error as :Execution failed for task':app:ndkBuild'. > Process 'command' C:/User/JVN/AppData/Local/Android/Sdk/ndk-bundle/ndk-build.cmd: finished with non-zero exit value 2. Can you please help me to fix the problem?

  42. Dmitry Stepanov Reply

    Hello, thanks so much for your videos. But i got a problem. I have made everything step by step like in the video, and there was no errors in Android Studio. But when i try to run the app on any devices (virtual or real), it crashes and gives me message "Unfortunately, NDKTest has stopped".

  43. Hey Great tutorial but I am having problem with the command line directory, I am using a MacBook so just changing to cv lab does not work. It gives me an error as it cannot find the Nik-build location. Any ideas what to do?

  44. Hey, dtdzung, I tried to follow your tutorial and I found out that when I try to build the .cpp file, there are several errors in my android studio:
    1. unknown type name 'JNIEXPORT'
    2. Error:Execution failed for task ':app:compileDebugNdk'.
    > Error while executing 'C:UserssuyuxAppDataLocalAndroidSdkndk-bundlendk-build.cmd' with arguments {NDK_PROJECT_PATH=null APP_PLATFORM=android-23 NDK_OUT=C:UserssuyuxAndroidStudioProjectsFace_Detection_v.3.0appbuildintermediatesndkdebugobj NDK_LIBS_OUT=C:UserssuyuxAndroidStudioProjectsFace_Detection_v.3.0appbuildintermediatesndkdebuglib APP_ABI=all}
    I also try to include C++ at the very begining to create a new android project but it is still not helpful.
    I would be really appreciated for your help~, Thank you

  45. nur nadhrah ahmad johar Reply

    hi,i type the ndk-build.cmd in command prompt but it said that c:program is not recognized as an internal or external command,operable program or batch file. i already add the path inside PATH inside system variable. what should i do to fix this? thanks.

Write A Comment