Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not invoke RNOpenCvLibrary.checkForBlurryImage #5

Open
AntaresRahman opened this issue Jun 10, 2018 · 18 comments
Open

Could not invoke RNOpenCvLibrary.checkForBlurryImage #5

AntaresRahman opened this issue Jun 10, 2018 · 18 comments

Comments

@AntaresRahman
Copy link

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!

@AntaresRahman
Copy link
Author

Hi, I still need help with this if anyone has any ideas. Thanks!

@Meph1k
Copy link
Contributor

Meph1k commented Jun 25, 2018

@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?

@pohsiu
Copy link

pohsiu commented Jul 10, 2018

I have same issue actually ....

@AntaresRahman
Copy link
Author

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?

@Meph1k
Copy link
Contributor

Meph1k commented Jul 10, 2018

@AntaresRahman If it doesn't work with a certain version of JDK, then you should rather head to the React Native team at Facebook :)

@pohsiu
Copy link

pohsiu commented Jul 10, 2018

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,

@AntaresRahman
Copy link
Author

@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!

@pohsiu
Copy link

pohsiu commented Jul 11, 2018

@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

@ltung
Copy link

ltung commented Jul 27, 2018

I did the gradle syncing and used jdk 1.8. Still have the same problem.

@ltung
Copy link

ltung commented Jul 30, 2018

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".

@abrararies
Copy link

Thanks @ltung your solution worked for me.

@piotr-s-brainhub
Copy link
Contributor

@AntaresRahman

does it work for you now?

@mirzakhalov
Copy link

@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.

@SwagatRanjit84
Copy link

@mirzakhalov is this working?

@davidrd108
Copy link

davidrd108 commented Mar 4, 2019

@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
/app/src/main/jniLibs/(armeabi|armeabi-v7a|x86|...).

2- rebuild.

Good Luck.

@piotr-s-brainhub
Copy link
Contributor

piotr-s-brainhub commented Feb 24, 2020

@AntaresRahman @pohsiu @ltung @mirzakhalov

does the @davidrd108 solution from the previous comment work for you?

@devkrkanhaiya
Copy link

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.

@piotr-s-brainhub
Copy link
Contributor

@devkrkanhaiya

I answered your issue (#22).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests