Prerequisites
- Ubuntu 14.04 LTS
- NVIDIA CodeWorks for Android 1R4
- Doc here
- Download here
- Could only select actions: CUDA ToolKit 7.0, CUDA for Android 7.0
- Android Studio
Prepare
|
|
Build
|
|
Result:
|
|
Make:
|
|
Alternatives (ignored):
|
|
Usage
Open “Android Studio” and,
- “Import Module” from “build_android_arm” directory.
- Exclude “jni”, only keep “aidl”, “java”, “res/values/attrs.xml”
Ensure it’s the same file structure as the offical OpenCV4Android.
About the sample project, you could find here.
Issues
Issue when cmake
Failed to get list of installed Android targets.
CMake Warning at cmake/OpenCVDetectAndroidSDK.cmake:205 (message):
Can not find any SDK target compatible with: 9 11
And,
|
|
Solution:
- Install Java SDK 1.8
- Fix “UnsupportedClassVersionError …”
Amend match of android sdk targets
1234$ cd opencv-3.2.0/$ vi cmake/OpenCVDetectAndroidSDK.cmake# line 98, change "[^\n]+" to "android-[0-9]+"string(REGEX MATCHALL "android-[0-9]+" ANDROID_SDK_TARGETS "${ANDROID_SDK_TARGETS}")- Or,
cmake
with-DANDROID_EXECUTABLE=$ANDROID_SDK/tools/bin/avdmanager
- WARN: However,
make
still will fail in “Generating OpenCV Android library project.”
- Or,
Issue when make
[ 92%] Generating OpenCV Android library project. SDK target: android-21
*************************************************************************
The "android" command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
*************************************************************************
Invalid or unsupported command "--silent create lib-project --path /home/john/Workspace/opencv-3.2.0/platforms/build_android_arm --target android-21 --name OpenCV --package org.opencv"
Supported commands are:
android list target
android list avd
android list device
android create avd
android move avd
android delete avd
android list sdk
android update sdk
make[2]: *** [build.xml] Error 2
make[1]: *** [modules/java/CMakeFiles/opencv_java.dir/all] Error 2
make: *** [all] Error 2
Solution:
- Downgrade android command-line tool 12345$ cd $ANDROID_SDK$ mv tools/ tools-backup/$ curl -O https://dl.google.com/android/repository/tools_r25.2.3-linux.zip$ unzip -q tools_r25.2.3-linux.zip
Learn more: