react-native-opencv-tutorial
react-native-opencv-tutorial copied to clipboard
Could not invoke RNOpenCvLibrary.checkForBlurryImage
I am getting the following error when I take a picture:
Could not invoke RNOpenCvLibrary.checkForBlurryImage
null
No implementation found for long org.opencv.core.Mat.n_Mat() (tried Java_org_opencv_core_Mat_n_1Mat and Java_org_opencv_core_Mat_n_1Mat__)
I found a similar issue on stackoverflow, but couldn't figure out how to solve this: https://stackoverflow.com/questions/35090838/no-implementation-found-for-long-org-opencv-core-mat-n-mat-error-using-opencv
Any clues? Thanks!
Hi, I still need help with this if anyone has any ideas. Thanks!
@AntaresRahman I cloned the repository and followed the steps in the README.MD file and couldn't reproduce your error. Can you add more details? Like what phone did you use?
I have same issue actually ....
I've tried it before with jdk 8, but now I'm using jdk 10. I suspect this might be the issue if it works with jdk 7. However if this is the issue, I would really still hope to get it to work with the latest java as jdk 7 is getting pretty old now:
$ java --version
java 10.0.1 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
I'm using One Plus 3 for testing.
For my gradle build, I'm using the following (same for gradle builds in OpenCV, react-native-camera and react-native-svg and I believe all other node_modules):
compileSdkVersion 28
buildToolsVersion "28.0.0"
defaultConfig {
applicationId "com.reactnativeopencvtutorial"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
My gradle-wrapper.properties is using distribution 4.8.1: distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip
With Android Plugin for Gradle:
classpath 'com.android.tools.build:gradle:3.1.0
I tried with the package.json that comes with this tutorial, but then I changed it to see if it works with everything set to latest:
{
"name": "reactNativeOpencvTutorial",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"lodash": "latest",
"react": "latest",
"react-native": "latest",
"react-native-camera": "latest",
"react-native-easy-toast": "latest",
"react-native-svg": "latest",
"ws": "latest"
},
"devDependencies": {
"babel-jest": "latest",
"babel-preset-react-native": "latest",
"jest": "latest",
"react-test-renderer": "latest"
},
"jest": {
"preset": "react-native"
}
}
Having no luck with that one error. This was the only related issue I found online: https://stackoverflow.com/questions/35090838/no-implementation-found-for-long-org-opencv-core-mat-n-mat-error-using-opencv
But the code for the opencv library seems a little different in the way that it's structured/implemented compared to the solution above. So I'm not quite understanding where to fit this solution. Mainly because I see that the Mat variable is declared in the checkForBlurryImage
method which is defined inside android/app/src/main/java/com/reactlibrary/RNOpenCvLibraryModule.java
. And then the Async Initialization of OpenCV using OpenCVManager is being handled in the android/app/src/main/java/com/reactnativeopencvtutorial/MainApplication.java
file. Maybe the issue is that RNOpenCvLibraryPackage()
is being called before loading OpenCV inside MainApplication.java
, because of the way Java 8 or 10 is compiling compared to Java 7?
@AntaresRahman If it doesn't work with a certain version of JDK, then you should rather head to the React Native team at Facebook :)
I tried to change build.gradle file on android studio, below android studio it would show up syn gradle now link, after that, it works,
other steps same as before, just this diff,
@Meph1k which jdk are you using? I'm not really sure if it's an issue with the jdk version.
@pohsiu which jdk are you using? Also, could you elaborate a little on that please? I might be having that same issue, but not quite sure what you mean. I will try to look at it soon and see if I understand what you mean, but some clarification would be great! :)
Thanks for the help!
@AntaresRahman I used 1.8 did you try modify your gradle file on android studio? that would appear a option "sync gradle now" after clicked it and sync, the error disappear
But you need restart, that means you need to back to square one
I did the gradle syncing and used jdk 1.8. Still have the same problem.
I figured out my problem. It is because I put the library in wrong folder. i.e. the native library should be in "jinLibs" instead of, incorrectly, "jinLibs\libs".
Thanks @ltung your solution worked for me.
@AntaresRahman
does it work for you now?
@piotr-s-brainhub I still can't figure why this is not working. http://answers.opencv.org/question/171681/android-canny-problem-no-implementation-found/ Here they say it could because of the OpenCV version, but I am not sure how to change in the code.
@mirzakhalov is this working?
@SwagatRanjit84 The next steps works for me. The problem is where you locate the main library. You can try these steps:
if you are using Android studio then:
1- Copy your OpenCV-android-sdk/sdk/native/libs/(armeabi|armeabi-v7a|x86|...) to
2- rebuild.
Good Luck.
@AntaresRahman @pohsiu @ltung @mirzakhalov
does the @davidrd108 solution from the previous comment work for you?
I'm also getting the same error. err [TypeError: null is not an object (evaluating '_OpenCV.default.checkForBlurryImage')] I tried above all solution but negative plz update solutions.
@devkrkanhaiya
I answered your issue (https://github.com/brainhubeu/react-native-opencv-tutorial/issues/22).