Building latest master for android but missing Java folder

asked 2019-07-09 19:58:37 -0500

eric_engineer gravatar image

updated 2019-07-10 10:34:51 -0500

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 ...
(more)
edit retag flag offensive close merge delete

Comments

1

wild guess: you're missing the ant tool (required to build anything java related)

please edit your question, and add the cmake console output as TEXT (it's long !), so we can look there for possible reasons

berak gravatar imageberak ( 2019-07-09 23:52:03 -0500 )edit
1

Sure, and thank you for all the help so far.

eric_engineer gravatar imageeric_engineer ( 2019-07-10 07:04:46 -0500 )edit
1
berak gravatar imageberak ( 2019-07-10 07:38:01 -0500 )edit
1

okay after installing ant, setting some env variables, and setting ANT_EXECUTABLE in Cmake I get Java wrappers YES. Now I'm hitting some kind of build error in the DNN module. I posted it above, and I'm trying to understand it myself too.

eric_engineer gravatar imageeric_engineer ( 2019-07-10 09:41:55 -0500 )edit

I disabled PROTBUF and now building the android project is failing because it can't find opencv

eric_engineer gravatar imageeric_engineer ( 2019-07-10 10:35:17 -0500 )edit