Skip to content

Android build fails with JDK 15 and NDK 22: Source option 6 is no longer supported. Use 7 or later #19567

@fspindle

Description

@fspindle
System information (version)
  • OpenCV => latest
  • Operating System / Platform => Android
  • Compiler => Android NDK 22
Detailed description

Build failed with the following error:

Compiling with JDK Java compiler API.
error: Source option 6 is no longer supported. Use 7 or later.
error: Target option 6 is no longer supported. Use 7 or later.
Task :opencv:compileDebugJavaWithJavac in 15-puzzle Finished
:opencv:compileDebugJavaWithJavac (Thread[Execution worker for ':' Thread 2,5,main]) completed. Took 0.465 secs.

FAILURE: Build failed with an exception.
Steps to reproduce
$ cd platform/android
$ python3 build_sdk.py --config ndk-22.config.py \
                       --sdk_path $HOME/Library/Android/sdk  \
                       --ndk_path $HOME/Library/Android/sdk/ndk-bundle \
                       $HOME/opencv-build-android-sdk \
                       $HOME/opencv

I'm on macOS Catalina 10.15.7 with Xcode 12.4. I use OpenJDK installed with brew:

$ brew install openjdk
$ sudo ln -sfn /usr/local/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
$ export JAVA_HOME=$(/usr/libexec/java_home)

Installed versions are:

$ java --version
openjdk 15.0.1 2020-10-20
$ python3 --version
Python 3.9.1
$ ant -version
Apache Ant(TM) version 1.10.9 compiled on September 27 2020
$ cmake -version
cmake version 3.19.5
$ ninja --version
1.10.2
$ ccache --version
ccache version 4.2
$ java --version
openjdk 15.0.1 2020-10-20
Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found solution
  • I updated to latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions