编译报错:
Build command failed.
Error while executing process /home/yuneec/Android/Sdk/ndk-bundle/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/app/src/main/jni/Android.mk NDK_APPLICATION_MK=/app/src/main/jni/Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=1 APP_PLATFORM=android-19 NDK_OUT=/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=/app/build/intermediates/ndkBuild/debug/lib /app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/libdl-jni.so}
[armeabi-v7a] Compile++ thumb: dl-jni <= com_yuneec_android_ob_gallery_FileDownloader.cpp
[armeabi-v7a] Compile++ thumb: dl-jni <= dwf_client_api.cpp
[armeabi-v7a] Compile++ thumb: dl-jni <= dwf_log.cpp
[armeabi-v7a] Compile++ thumb: dl-jni <= dwf_packet.cpp
In file included from /app/src/main/jni/gallery/dwf_packet.cpp:9:0:
/app/src/main/jni/gallery/dwf_packet.h:44:69: error: ‘socklen_t’ has not been declared
int pktSendto(int sockfd, int sendLen, sockaddr *peeraddr, socklen_t peeraddrLen);
^
/app/src/main/jni/gallery/dwf_packet.h:45:58: error: ‘socklen_t’ has not been declared
int pktRecvfrom(int sockfd, sockaddr *peeraddr, socklen_t peeraddrLen);
^
/app/src/main/jni/gallery/dwf_packet.cpp:326:5: error: ‘socklen_t’ has not been declared
socklen_t peeraddrLen)
^
/app/src/main/jni/gallery/dwf_packet.cpp: In member function 'int yuneec::CPacket::recv_peek(int, const void, int)’:
/app/src/main/jni/gallery/dwf_packet.cpp:430:52: error: ‘recv’ was not declared in this scope
ret = recv(fd, (void *)buf, count, MSG_PEEK);
^
/app/src/main/jni/gallery/dwf_packet.cpp: At global scope:
/app/src/main/jni/gallery/dwf_packet.cpp:447:5: error: ‘socklen_t’ has not been declared
socklen_t *peeraddrLen)
^
make: *** [/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/dl-jni/dwf_packet.o] Error 1
解决方案:
更改ndk版本:File—>Project Structure—>SDK Location—>Android NDK location