In the ANDROIDNDK development process, the C/D + + code written under the JNI folder in the engineering directory usually appears with several types of errors as follows:
1, unresolved inclusion:<xxx>
2. Syntax error
3, Function ' XXX ' could not being resolved
4. Type ' XXX ' could not being resolved
5. Symbol ' XXX ' could not being resolved
6, Method ' XXX ' could not being resolved
7. Invalid arguments ' candidates is: ... '
1 Error form one: No import header file (This is the biggest error, will cause a series of errors below). There are usually the following forms of expression:
1, unresolved inclusion: <jni.h>, unresolved inclusion: <stdio.h>, unresolved inclusion: <malloc.h>, Unresolved inclusion: <Android/log.h> 、...
2. Function ' __android_log_print ' could not being resolved, type ' jnienv ' could not being resolved, type ' jstring ' could not being res olved, Type ' Jclass ' could not being resolved, function ' malloc ' could not being resolved, function ' memcpy ' could not being resolved , Method ' Findclass ' could not being resolved, Type ' jsize ' could not being resolved, Symbol ' NULL ' could not being resolved 、...
Workaround: Right-click the item--Properties--left/C + +--Paths and Symbols--right includes---GNU C + + (. cpp)-- Add-->${ndkroot}\platforms\android-18\arch-arm\usr\include (tips: the NDK platforms\ here Android-18 must be consistent with target in the properties of your project).
2 Error Form two:
1, unresolved inclusion: <iostream>, unresolved inclusion: <fstream>, Symbol ' std ' could not being resolved 、..
2. Type ' FStream ' could not being resolved, Symbol ' in ' could not being resolved, method ' SEEKG ' could not being resolved, method ' read ' could not being resolved 、...
Workaround: Add path (see workaround above): ${ndkroot}\sources\cxx-stl\gnu-libstdc++\4.8\include, ${ndkroot}\sources\cxx-stl\ Gnu-libstdc++\4.8\libs\armeabi\include.
3 Error Form three: Invalid arguments ' candidates are:void * malloc (?) ', Invalid arguments ' candidates are:void * memcpy (void *, cons t void *,?) '
Workaround: Add a path (see workaround above): ${ndkroot}\toolchains\arm-linux-androideabi-4.8\prebuilt\windows\lib\gcc\ Arm-linux-androideabi\4.8\include
Solved the mistake, everyone has fun
Android NDK Error (Eclipse) and workaround