0
openCvリファレンスで自分のアンドロイドプロジェクトを作成し、プロジェクトを設定し、モジュールとしてSDKにjavaを追加し、すべてのlibs(異なるCPUタイプ)をjinLibsにコピーします!私はこの例外を得た私のプロジェクトをビルドしようとすると、私はlibdetection_based_tracker
Android OpenCV未定義のネイティブクラスへの参照
という名前の1つのネイティブクラスを持っている:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "ir.whiteapp.maremat"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags ""
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
sourceSets { main { jni.srcDirs = ['src/main/jni', 'src/main/jniLibs/'] } }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.1'
testCompile 'junit:junit:4.12'
compile project(':openCVLibrary320')
}
と私のCmakeList
:ここCMakeFiles/libdetection_based_tracker.dir/src/main/cpp/libdetection_based_tracker.cpp.o: In function `Java_ir_whiteapp_maremat_DetectionBasedTracker_nativeCreateObject':
G:\AR\Maremat\app\src\main\cpp/libdetection_based_tracker.cpp:28: undefined reference to `DetectionBasedTracker::Parameters::Parameters()'
G:\AR\Maremat\app\src\main\cpp/libdetection_based_tracker.cpp:31: undefined reference to `DetectionBasedTracker::DetectionBasedTracker(std::string const&, DetectionBasedTracker::Parameters const&)'
CMakeFiles/libdetection_based_tracker.dir/src/main/cpp/libdetection_based_tracker.cpp.o: In function `Java_ir_whiteapp_maremat_DetectionBasedTracker_nativeSetFaceSize':
G:\AR\Maremat\app\src\main\cpp/libdetection_based_tracker.cpp:64: undefined reference to `DetectionBasedTracker::getParameters()'
G:\AR\Maremat\app\src\main\cpp/libdetection_based_tracker.cpp:66: undefined reference to `DetectionBasedTracker::setParameters(DetectionBasedTracker::Parameters const&)'
CMakeFiles/libdetection_based_tracker.dir/src/main/cpp/libdetection_based_tracker.cpp.o: In function `cv::Mat::operator=(cv::Mat const&)':
は私のアプリレベルのGradleファイルです
cmake_minimum_required(VERSION 3.4.1)
include_directories(src/main/jniLibs/jni/include)
add_library(lib_opencv SHARED IMPORTED)
set_target_properties(lib_opencv PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/libopencv_java3.so)
add_library(native-lib SHARED src/main/cpp/native-lib.cpp)
add_library(libdetection_based_tracker SHARED src/main/cpp/libdetection_based_tracker.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})
プロジェクト全体がhere jinLibs fなしile!これはNDKとOpenCVで作業する私の最初の試みですが、私の質問の一部があいまいであるかどうか私に尋ねてください!
を私はOpenCVの3.2.0をダウンロードしますが、私のlibフォルダがlibasmlibrary.soが含まれていません!私のプロジェクトには必要なのですか? –