gpt4 book ai didi

opencv - AndroidStudio中的JavaCV错误java.lang.NoClassDefFoundError:java.lang.ClassNotFoundException:org.bytedeco.javacpp.opencv_core

转载 作者:行者123 更新时间:2023-12-02 17:38:13 24 4
gpt4 key购买 nike

我正在使用JavaCV开发人脸识别系统。我同时使用OpenCV和JavaCV。我也在使用AndroidStudio。
但是,它向我显示此错误。

12-20 00:22:25.315 6018-6018/com.example.nasif.xiomi_face E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.nasif.xiomi_face, PID: 6018
java.lang.NoClassDefFoundError: java.lang.ClassNotFoundException: org.bytedeco.javacpp.opencv_core
at org.bytedeco.javacpp.Loader.load(Loader.java:590)
at org.bytedeco.javacpp.Loader.load(Loader.java:530)
at org.bytedeco.javacpp.opencv_core$MatVector.<clinit>(opencv_core.java:475)
at com.example.nasif.xiomi_face.Myjavacvface.training_facerecognition(Myjavacvface.java:58)
at com.example.nasif.xiomi_face.MainActivity.onOptionsItemSelected(MainActivity.java:148)
at android.app.Activity.onMenuItemSelected(Activity.java:2644)
at android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:368)
at android.support.v7.app.AppCompatActivity.onMenuItemSelected(AppCompatActivity.java:195)

建立gradle
apply plugin: 'com.android.application'

android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.nasif.xiomi_face"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
// add
compile 'com.google.android.gms:play-services-vision:11.6.2'
compile 'org.bytedeco:javacv:1.1'
compile 'org.bytedeco.javacpp-presets:opencv:3.0.0-1.1'

implementation files('libs/jxl-2.6.12.jar')
implementation project(':openCVLibrary24134')

}

您能帮我解决这个问题吗?谢谢。

最佳答案

如果有人遇到类似问题,那么解决方法是:在gradle中添加这3行,然后进行构建。

compile 'org.bytedeco:javacv:1.3.3'   
compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.2.0-1.3', classifier: 'android-arm'
compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '3.2.1-1.3', classifier: 'android-arm'

替代方案:
  compile 'org.bytedeco:javacv:1.1'
compile 'org.bytedeco.javacpp-presets:opencv:3.0.0-1.1:android-arm'
compile 'org.bytedeco.javacpp-presets:ffmpeg:2.8.1-1.1:android-arm'

关于opencv - AndroidStudio中的JavaCV错误java.lang.NoClassDefFoundError:java.lang.ClassNotFoundException:org.bytedeco.javacpp.opencv_core,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47893193/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com