Android notes, android learning notes
1. Do not pass the int value to the setText function of the textview control, because when you pass the int type, it will assume that it is a resource id.
The following error is reported: java. lang. runtimeException: Unable to start activity ComponentInfo {com. example. ndktest/com. example. ndktest. mainActivity}: android. content. res. resources $ NotFoundException: Unable to find resource ID #0x4
Note that the last 4 is actually the value that I want to pass to the setText function.
2. java. lang. UnsatisfiedLinkError: Native method not found two possible solutions
A. Jni method header case sensitivity problem: in C ++, the method name is Java_com_XXX instead of java_com_XXX. We recommend that you directly copy the method name from the generated. h header file to the C or C ++ file.
B. C ++ file problem: if it is a C ++ file (. cpp or. cc), use extern "C" {} to include the local method.