I'm trying to build the latest master for Android. I struggled for a while but finally got cmake, cygwin, NDK and SDK to all work together and compile. I built for shared libraries but I can't figure out why there's no java directory generated.
If I download 4.1 in the sdk directory I see:
etc
native
java
Where java contains what looks like the wrapper for opencv as well as an android manifest file.
When I build master all I get are:
etc
native
So no java, and also only abi-armeabi-v7a, no abi-arm64-v8a (maybe that's the cross compile options?).
Also my cmake output under Java: says "Java wrappers: NO" It is finding my python installation which was a problem I saw in another post.
So I'm not sure how to get my java directory, and how to build for ARM-64 architecture.
Thank you
EDIT3-- Failing at build install
Configure project :
Evaluating root project 'android_sdk' using build file 'D:\opencv_git\opencv\bui
ld_android\modules\java\android_sdk\build.gradle'.
All projects evaluated.
FAILURE: Build failed with an exception.
What went wrong:
Project 'opencv' not found in root project 'android_sdk'.
Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to
get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 56s
modules\java\android_sdk\CMakeFiles\opencv_java_android.dir\build.make:60: recip
e for target '/opencv/build/outputs/aar/opencv-release.aar' failed
mingw32-make[2]: * [/opencv/build/outputs/aar/opencv-release.aar] Error 1
CMakeFiles\Makefile2:2110: recipe for target 'modules/java/android_sdk/CMakeFile
s/opencv_java_android.dir/all' failed
mingw32-make[1]: [modules/java/android_sdk/CMakeFiles/opencv_java_android.di
r/all] Error 2
Makefile:161: recipe for target 'all' failed
mingw32-make: ** [all] Error 2
EDIT2-- Failing at protobuf
This looks like it's because of the line
modules/dnn/opencv-caffe.pb.h: ../modules/dnn/protobuf::protoc
In dnn\CMakeFiles\opencv_dnn.dir\build.make
It doesn't like the ::. I tried escaping it but that only go me a little further. So I disabled it in cmake and moved on.
EDIT--- Cmake output
Detected processor: armv7-a
sizeof(void) = 4 on 64 bit processor. Assume 32-bit compilation mode
Looking for ccache - not found
OpenCV disables pkg-config to avoid using of host libraries. Consider using PKG_CONFIG_LIBDIR to specify target SYSROOT
libjpeg-turbo: VERSION = 2.0.2, BUILD = opencv-4.1.1-pre-libjpeg-turbo
Android: Projects builds are DISABLED
Excluding from source files list: modules/imgproc/src/corner.avx.cpp
Excluding from source files list: modules/imgproc/src/imgwarp.avx2.cpp
Excluding from source files list: modules/imgproc/src/imgwarp.sse4_1.cpp
Excluding from source files list: modules/imgproc/src/resize.avx2.cpp
Excluding from source files list: modules/imgproc/src/resize.sse4_1.cpp
Excluding from source files list: modules/imgproc/src/sumpixels.avx512_skx.cpp
Registering hook 'INIT_MODULE_SOURCES_opencv_dnn': D:/opencv_git/opencv/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
opencv_dnn: filter out ocl4dnn source code
opencv_dnn: filter out cuda4dnn source code
Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx.cpp
Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx2.cpp
Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx512_skx.cpp
Excluding from source files list: modules/features2d/src/fast.avx2.cpp
Excluding from source files list: modules/calib3d/src/undistort.avx2.cpp
Sample example-tutorial-4-opencl is disabled, because ANDROID_OPENCL_SDK is not specified
Android OpenCV Manager is ignored
Generating ABI compliance checker configuration: opencv_abi.xml
General configuration for OpenCV 4.1.1-pre =====================================
Version control: 4.1.0-533-gde4d304d9-dirty
Platform:
Timestamp: 2019-07-09T19:21:23Z
Host: Windows 6.1.7601 AMD64
Target: Android 1 armv7-a
CMake: 3.15.0-rc3
CMake generator: MinGW Makefiles
CMake build tool: C:/MinGW/bin/mingw32-make.exe
Configuration: Release
CPU/HW features:
Baseline:
requested: DETECT
C/C++:
Built as dynamic libs?: YES
C++ Compiler: D:/ndks/android-ndk-r16b-windows-x86_64/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++.exe (ver 4.9.0)
C++ flags (Release): -fexceptions -frtti -Wno-psabi --sysroot=D:/ndks/android-ndk-r16b-windows-x86_64/android-ndk-r16b/platforms/android-27/arch-arm -funwind-tables -finline-limit=64 -fsigned-char -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fdata-sections -ffunction-sections -Wa,--noexecstack -DANDROID -D__ANDROID_API__=27 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-comment -Wno-missing-field-initializers -fdiagnostics-show-option -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -mthumb -fomit-frame-pointer -fno-strict-aliasing -O3 -DNDEBUG -DNDEBUG
C++ flags (Debug): -fexceptions -frtti -Wno-psabi --sysroot=D:/ndks/android-ndk-r16b-windows-x86_64/android-ndk-r16b/platforms/android-27/arch-arm -funwind-tables -finline-limit=64 -fsigned-char -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fdata-sections -ffunction-sections -Wa,--noexecstack -DANDROID -D__ANDROID_API__=27 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-comment -Wno-missing-field-initializers -fdiagnostics-show-option -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -marm -fno-omit-frame-pointer -fno-strict-aliasing -O0 -g -DDEBUG -D_DEBUG -DDEBUG -D_DEBUG
C Compiler: D:/ndks/android-ndk-r16b-windows-x86_64/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-gcc.exe
C flags (Release): -fexceptions -Wno-psabi --sysroot=D:/ndks/android-ndk-r16b-windows-x86_64/android-ndk-r16b/platforms/android-27/arch-arm -funwind-tables -finline-limit=64 -fsigned-char -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fdata-sections -ffunction-sections -Wa,--noexecstack -DANDROID -D__ANDROID_API__=27 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wuninitialized -Winit-self -Wno-comment -Wno-missing-field-initializers -fdiagnostics-show-option -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -mthumb -fomit-frame-pointer -fno-strict-aliasing -O3 -DNDEBUG -DNDEBUG
C flags (Debug): -fexceptions -Wno-psabi --sysroot=D:/ndks/android-ndk-r16b-windows-x86_64/android-ndk-r16b/platforms/android-27/arch-arm -funwind-tables -finline-limit=64 -fsigned-char -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fdata-sections -ffunction-sections -Wa,--noexecstack -DANDROID -D__ANDROID_API__=27 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wuninitialized -Winit-self -Wno-comment -Wno-missing-field-initializers -fdiagnostics-show-option -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -marm -fno-omit-frame-pointer -fno-strict-aliasing -O0 -g -DDEBUG -D_DEBUG -DDEBUG -D_DEBUG
Linker flags (Release): -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,-allow-shlib-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--gc-sections
Linker flags (Debug): -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,-allow-shlib-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--gc-sections
ccache: NO
Precompiled headers: NO
Extra dependencies: dl m log
3rdparty dependencies:
OpenCV modules:
To be built: calib3d core dnn features2d flann highgui imgcodecs imgproc ml objdetect photo stitching ts video videoio
Disabled: world
Disabled by dependency: -
Unavailable: gapi java js python2 python3
Applications: -
Documentation: NO
Non-free algorithms: NO
Android NDK: location: D:/ndks/android-ndk-r16b-windows-x86_64/android-ndk-r16b
Android ABI: armeabi-v7a
NDK toolchain: arm-linux-androideabi-4.9
STL type: gnustl_static
Native API level: 27
Android SDK: not used, projects are not built
GUI:
Media I/O:
ZLib: z (ver 1.2.3)
JPEG: build-libjpeg-turbo (ver 2.0.2-62)
WEBP: build (ver encoder: 0x020e)
PNG: build (ver 1.6.37)
TIFF: build (ver 42 - 4.0.10)
JPEG 2000: build (ver 1.900.1)
OpenEXR: build (ver 2.3.0)
HDR: YES
SUNRASTER: YES
PXM: YES
PFM: YES
Video I/O:
Parallel framework: pthreads
Trace: YES (with Intel ITT)
Other third-party libraries:
Custom HAL: YES (carotene (ver 0.0.1))
Protobuf: build (3.5.1)
Python (for build): C:/Users/ericsteimle.banc3/AppData/Local/Programs/Python/Python35-32/python.exe
Java:
ant: NO
Java wrappers: NO
Java tests: NO
Install to: D:/opencv_git/opencv/build_android/install
-----------------------------------------------------------------
Configuring done
Generating done