JNI erreur de compilation sur Studio Android 2.3.2
Je fais application à diffuser de la vidéo de téléphone à la chaîne youtube. J'ai trouvé ce lien https://github.com/youtube/yt-watchme.
Lors de la compilation de mon code, j'obtiens l'erreur
libavutil not found in file avecode.h at code #include "libavutil/samplefmt.h
J'ai aussi changé #include "../libavutil/samplefmt.h" toujours la même erreur.
Peut-être suggérer une bonne bibliothèque rtmp pour diffuser la vidéo du téléphone sur le canal youtube.
Error:FAILURE: Build failed with an exception. * What went wrong:
Execution failed for task ':app:externalNativeBuildDebug'.
Build command failed.
Error while executing process/Users/nomankhan/Library/Android/sdk/cmake/3.6.4111459/bin/cmake with arguments {--build /Clients/Ankur/JniDemo/app/.externalNativeBuild/cmake/debug/mips64 --target native-lib}
[1/2] Building CXX object CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o
FAILED: /Users/nomankhan/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=mips64el-none-linux-android --gcc-toolchain=/Users/nomankhan/Library/Android/sdk/ndk-bundle/toolchains/mips64el-linux-android-4.9/prebuilt/darwin-x86_64 --sysroot=/Users/nomankhan/Library/Android/sdk/ndk-bundle/sysroot -Dnative_lib_EXPORTS -I../../../../src/main/cpp/include/libavcodec -I../../../../src/main/cpp/include/libavformat -I../../../../src/main/cpp/include/libavutil -isystem /Users/nomankhan/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem /Users/nomankhan/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/mips64/include -isystem /Users/nomankhan/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/backward -isystem /Users/nomankhan/Library/Android/sdk/ndk-bundle/sysroot/usr/include/mips64el-linux-android -D__ANDROID_API__=21 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -fintegrated-as -Wa,--noexecstack -Wformat -Werror=format-security -O0 -fno-limit-debug-info -fPIC -MD -MT CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o -MF CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o.d -o CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o -c /Clients/Ankur/JniDemo/app/src/main/cpp/native-lib.cppIn file included from /Clients/Ankur/JniDemo/app/src/main/cpp/native-lib.cpp:4: /Clients/Ankur/JniDemo/app/src/main/cpp/libavcodec/avcodec.h:31:10: fatal error: 'libavutil/samplefmt.h' file not found #include "libavutil/samplefmt.h" ^~~~~~~~~~~~~~~~~~~~~~~
Mon CMakeLists.txt
cmake_minimum_required(VERSION 3.4.1)
add_library(# Sets the name of the library.
native-lib
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
src/main/cpp/native-lib.cpp)
find_library(# Sets the name of the path variable.
log-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
log)
target_link_libraries(# Specifies the target library.
native-lib
# Links the target library to the log library
# included in the NDK.
${log-lib})
include_directories(src/main/cpp/include/libavcodec)
include_directories(src/main/cpp/include/libavformat)
include_directories(src/main/cpp/include/libavutil)
Je crois que vous avez besoin de 'include_directories (src/main/cpp)' à la place des trois dernières instructions. Dans ** native-lib.cpp **, vous devriez avoir '#include" libavcodec/avcodec.h "'. –