Android NDK Native method not found error

后端 未结 1 1926
一整个雨季
一整个雨季 2021-01-07 23:52

I am trying to build android application using native code so i want to test if ndk runs successfully.When i try to run my first hello world project log cat says,

         


        
相关标签:
1条回答
  • 2021-01-08 00:37

    Your package/class names do not match.

    JNIEXPORT jstring JNICALL   Java_com_example_ndktesting_ndktest_MainActivity_invokeNativeFunction(JNIEnv* env, jobject  thiz)
    

    Would be a method in the class

    com.example.ndktesting.ndktest.MainActivity
    

    However your actual code

    package com.example.ndktesting;
    
    public class MainActivity extends Activity 
    

    causes it to look for

    com.example.ndktesting.MainActivity.invokeNativeFunction
    

    without the "ndktest"

    Once you make the names match it should either work, or expose the next issue.

    0 讨论(0)
提交回复
热议问题