[英]Cannot resolve symbol com.googlecode.javacv.cpp.opencv_contrib.FaceRecognizer in android studio
So I have a project to create an face recognition app.所以我有一个项目来创建一个人脸识别应用程序。 In this project I tried to import :在这个项目中,我尝试导入:
import com.googlecode.javacv.cpp.opencv_contrib.FaceRecognizer;
import com.googlecode.javacv.cpp.opencv_core.IplImage;
import com.googlecode.javacv.cpp.opencv_core.MatVector;
import com.googlecode.javacv.cpp.opencv_imgproc;
But gradle cannot find the symbol for it.但是 gradle 找不到它的符号。 I already import the java module from OpenCV library, but still cannot resolve it.我已经从 OpenCV 库中导入了 java 模块,但仍然无法解析它。 Please help me.Thx请帮帮我。谢谢
Here is the code for gradle这是gradle的代码
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "example.com.facerecognation"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { jni.srcDirs = ['src/main/jni', 'src/main/jniLibs/'] } }
}
dependencies {
implementation project(':openCVLibrary2410')
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.github.bumptech.glide:glide:4.3.1'
implementation 'com.github.markushi:circlebutton:1.1'
implementation "androidx.cardview:cardview:1.0.0"
}
import static
is for Methods. import static
用于方法。
Methods need to be in a class and classes need to be inside a package.方法需要在一个类中,而类需要在一个包中。
For example, you could have the class MyClass
in the package com.example
.例如,您可以在包com.example
有MyClass
类。
You can import this class using import com.example.MyClass
.您可以使用import com.example.MyClass
导入此类。
If you want to statically import a method(eg myMethod
) from this class, you'll need to write import static com.example.MyClass.myMethod
如果你想从这个类中静态导入一个方法(例如myMethod
),你需要编写import static com.example.MyClass.myMethod
If you can do如果你能做到
import com.googlecode.javacv.cpp.opencv_core.MatVector;导入 com.googlecode.javacv.cpp.opencv_core.MatVector;
that means that com.googlecode.javacv.cpp.opencv_core
is a package.这意味着com.googlecode.javacv.cpp.opencv_core
是一个包。
Methods/constants need to be in a class.方法/常量需要在一个类中。
Therefore, com.googlecode.javacv.cpp.opencv_core.IPL_DEPTH_8U
cannot be imported statically.因此,无法静态导入com.googlecode.javacv.cpp.opencv_core.IPL_DEPTH_8U
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.