rosettadrone: Compile error in native libs

Getting this error w/ native compiling, on a mac, using Android Studio etc

Error while executing process /Users/kevin_watkins/Library/Android/sdk/cmake/3.6.4111459/bin/cmake with arguments {--build /grindhouse/workspace/rosettadrone/app/.externalNativeBuild/cmake/debug/armeabi-v7a --target djivideojni}
[1/1] Linking C shared library ../../../../build/intermediates/cmake/debug/obj/armeabi-v7a/libdjivideojni.so
FAILED: : && /Users/kevin_watkins/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang  --target=armv7-none-linux-androideabi23 --gcc-toolchain=/Users/kevin_watkins/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64 --sysroot=/Users/kevin_watkins/Library/Android/sdk/ndk-bundle/sysroot -fPIC -isystem /Users/kevin_watkins/Library/Android/sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -mfpu=neon -Wa,--noexecstack -Wformat -Werror=format-security  -O0 -fno-limit-debug-info  -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -nostdlib++ --sysroot /Users/kevin_watkins/Library/Android/sdk/ndk-bundle/platforms/android-23/arch-arm -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--fix-cortex-a8 -Wl,--exclude-libs,libunwind.a -L/Users/kevin_watkins/Library/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libdjivideojni.so -o ../../../../build/intermediates/cmake/debug/obj/armeabi-v7a/libdjivideojni.so CMakeFiles/djivideojni.dir/src/main/cpp/dji_video_jni.c.o  ../../../../src/main/cpp/lib/armeabi-v7a/libffmpeg.so -llog -latomic -lm && :
/Users/kevin_watkins/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: ../../../../src/main/cpp/lib/armeabi-v7a/libffmpeg.so:1:9: syntax error, unexpected STRING
/Users/kevin_watkins/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: ../../../../src/main/cpp/lib/armeabi-v7a/libffmpeg.so: not an object or archive
/grindhouse/workspace/rosettadrone/app/src/main/cpp/dji_video_jni.c:42: error: undefined reference to 'av_register_all'
/grindhouse/workspace/rosettadrone/app/src/main/cpp/dji_video_jni.c:44: error: undefined reference to 'av_codec_next'
/grindhouse/workspace/rosettadrone/app/src/main/cpp/dji_video_jni.c:76: error: undefined reference to 'avcodec_register_all'
/grindhouse/workspace/rosettadrone/app/src/main/cpp/dji_video_jni.c:77: error: undefined reference to 'av_register_all'
/grindhouse/workspace/rosettadrone/app/src/main/cpp/dji_video_jni.c:80: error: undefined reference to 'avcodec_find_decoder'
/grindhouse/workspace/rosettadrone/app/src/main/cpp/dji_video_jni.c:81: error: undefined reference to 'avcodec_alloc_context3'
/grindhouse/workspace/rosettadrone/app/src/main/cpp/dji_video_jni.c:82: error: undefined reference to 'av_parser_init'
/grindhouse/workspace/rosettadrone/app/src/main/cpp/dji_video_jni.c:94: error: undefined reference to 'avcodec_open2'
/grindhouse/workspace/rosettadrone/app/src/main/cpp/dji_video_jni.c:99: error: undefined reference to 'av_frame_alloc'
/grindhouse/workspace/rosettadrone/app/src/main/cpp/dji_video_jni.c:120: error: undefined reference to 'av_init_packet'
/grindhouse/workspace/rosettadrone/app/src/main/cpp/dji_video_jni.c:129: error: undefined reference to 'av_parser_parse2'
/grindhouse/workspace/rosettadrone/app/src/main/cpp/dji_video_jni.c:162: error: undefined reference to 'av_free_packet'
/grindhouse/workspace/rosettadrone/app/src/main/cpp/dji_video_jni.c:214: error: undefined reference to 'avcodec_close'
/grindhouse/workspace/rosettadrone/app/src/main/cpp/dji_video_jni.c:218: error: undefined reference to 'av_free'
/grindhouse/workspace/rosettadrone/app/src/main/cpp/dji_video_jni.c:219: error: undefined reference to 'av_free'
/grindhouse/workspace/rosettadrone/app/src/main/cpp/dji_video_jni.c:220: error: undefined reference to 'av_parser_close'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

	at com.android.build.gradle.tasks.ExternalNativeBuildTaskUtils.executeBuildProcessAndLogError(ExternalNativeBuildTaskUtils.java:244)
	at com.android.build.gradle.tasks.ExternalNativeBuildTask.executeProcessBatch(ExternalNativeBuildTask.java:307)
	at com.android.build.gradle.tasks.ExternalNativeBuildTask.build(ExternalNativeBuildTask.java:185)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
	... 119 more

About this issue

Most upvoted comments

I had this problem too and the way I solved was doing this (Windows):

git lfs install

It should say “Git LFS initialized.” Then

GIT_SSL_NO_VERIFY=1 git clone https://github.com/diux-dev/rosettadrone.git

After that I could finally build the apk.

@kikislater Cant confirm environment variable option because I’ve repeated it again and It didn’t work. Dependencies weren’t properly downloaded. I guess there must be a better way to include them into project.

I confirm that release archive 1.2.1 also has incomplete libffmpeg.so file.

Such a long way to go to launch my Mavic…

For all. You can install git lfs. However, It hasn’t helped for me. After messing around cmake and ninja, I needed t to check linking error as described above. I figured out that libffmpeg.so size is different to one downloaded manually from here https://github.com/diux-dev/rosettadrone/blob/master/app/src/main/cpp/lib/armeabi-v7a/libffmpeg.so

I think I know the issue, it has to do with those files using Git Large File Storage (git lfs) You may want to add that to the README, similar to the important bullet at https://github.com/DJI-Mobile-SDK-Tutorials/Android-VideoStreamDecodingSample and pointing to installation of https://github.com/git-lfs/git-lfs/wiki/Installation

After installing git lfs, I then got:

Downloading app/src/main/cpp/lib/arm64-v8a/libffmpeg.so (20 MB)
Error downloading object: app/src/main/cpp/lib/arm64-v8a/libffmpeg.so (b5d53aa): Smudge error: Error downloading app/src/main/cpp/lib/arm64-v8a/libffmpeg.so (b5d53aa66e88d04079d6217f425d3ba39340d997f083f1682f78036e523f1418): batch response: Post https://github.com/diux-dev/rosettadrone.git/info/lfs/objects/batch: x509: certificate signed by unknown authority

So then to ignore verification:

GIT_SSL_NO_VERIFY=1 git clone https://github.com/diux-dev/rosettadrone.git

This then compiled and linked successfully.