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

Compilation error #2

Open
xkraty opened this issue Aug 2, 2017 · 28 comments
Open

Compilation error #2

xkraty opened this issue Aug 2, 2017 · 28 comments

Comments

@xkraty
Copy link

xkraty commented Aug 2, 2017

Hello,

I've added "react-native-scan-doc": "git+https://[email protected]/beast/react-native-scan-doc.git" and npm install the package; I both tried manual and linking installation and it fail at compiling, it might something stupid to you but I'm not so used about Android.

Console output:

Scanning 696 folders for symlinks in /Users/xkraty/projects/bridge-mobile/node_modules (18ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Incremental java compilation is an incubating feature.

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/xkraty/projects/bridge-mobile/node_modules/react-native-scan-doc/android/build.gradle' line: 36

* What went wrong:
A problem occurred evaluating project ':react-native-scan-doc'.
> Project with path ':openCVLibrary320' could not be found in project ':react-native-scan-doc'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Thanks in advance
Chris

@beast
Copy link
Owner

beast commented Aug 3, 2017

Hi @xkraty. Thanks for opening the issue. This is something I wanted to add in the readme. Getting Opencv package to play nicely with RN out-of-box is almost impossible. Believe me I had tried make it as dummy as possible to the best of my knowledge. But the reality is setting up opencv to work nicely with Android itself is a challenging enough task. I suggest you look at a few examples to understand how OpenCV works with Android first then proceed to manual installation.
https://blog.nishtahir.com/2015/11/11/setting-up-for-android-ndk-development/

Try out my Android Native Scan Doc sample if you want to first check out how the scan doc helps you to crop a doc in image.

Again, I am open to have some help from the community to improve the package documentation. Thanks for opening the issue. I understand most of the scan doc package out there cost a fortune but OpenCV is no easy thing to deal with and I would like to have some serious help.

I myself unfortunately is tied up with other work of my own. Will look into this seriously once I got time and resource. Thanks.

@ducpt2
Copy link

ducpt2 commented Oct 22, 2017

@xkraty Can you make it work? Thanks.

@xkraty
Copy link
Author

xkraty commented Oct 23, 2017

@ducpt2 no sorry, we dropped it in favor of scanbot even if it require a license

@beast
Copy link
Owner

beast commented Oct 24, 2017

@xkraty I was asked to pay 20k Euro a year that is exactly why I started this repo...

@xkraty
Copy link
Author

xkraty commented Oct 24, 2017

@beast I am sorry I didn't mean minimize your work or blame you since you did a great job here, we just didn't have enough skill/time to dig into Android and the company wanted it fast, so they'll pay for.

@khrizt
Copy link

khrizt commented Oct 24, 2017

@beast I was following this repo because I'm migrating mobile apps to react native and one feature the Android app has is a document Scanner done with OpenCV. I managed to get it to work in Android and we have released it. I could help if I can. What would you need?

I'm thinking that you probably need a installation instructions on how set up the OpenCV library in android and checking that it works ok, anything else? I will try to get into this as soon as I can.

@beast
Copy link
Owner

beast commented Oct 24, 2017

@khrizt Yes. Please help on the installation instructions. That will be greatly appreciated. Another thing I was wondering is how to get OpenCV installation work with this package automatically. Thanks!

@khrizt
Copy link

khrizt commented Oct 24, 2017

@beast Ok, I'll look into it and let you know.

@beast
Copy link
Owner

beast commented Oct 24, 2017

@xkraty No offence taken. I did understand the frustration of people not able to get it working. Unfortunately I couldn't invest more time to explain how exactly this works due to my own work. Really hope I could get some help or I could manage to find some time for this.

@ducpt2
Copy link

ducpt2 commented Oct 24, 2017

@beast I very appreciated your work :) Thanks.
@khrizt Hope you can help, thank you so much. I have try to bridge from this repo: https://github.com/Aniruddha-Tapas/Document-Scanner, but no luck, i am a iOS developer switch to React Native, i have no idea about Android. :(

@khrizt
Copy link

khrizt commented Oct 26, 2017

Ok, I managed to compile and run the example but with a couple of errors, I found an error here: scanDocPackage.onActivityCreated(activity); because it says that the method is not found, what's the purpose of that?

Also have you considered using the camera built-in in OpenCV instead of a react native module?

Sorry I didn't mentioned you @beast

@ducpt2
Copy link

ducpt2 commented Oct 26, 2017

@khrizt thank you for your effort. Pls let us know if you can fix it :) Thanks.

@beast
Copy link
Owner

beast commented Oct 30, 2017

@khrizt Thanks for the looking into this. It has been quite a while ago so it could be somewhere down the road of RN changes that this is no longer needed. I did it because back then I had a problem retrieving the activity from Android for RN consumption. I had seen built-in openCV like an iOS lib that does this but the edge detection was pretty bad when I mix with other objects. Anyway, I know my detection code is good in Native Android, see https://github.com/beast/android-opencv-scan-doc

And I had built RN lib before, but I am really not sure how to make openCV play nicely with RN. Do you mind sharing what you did with your own project? Thanks.

@khrizt
Copy link

khrizt commented Nov 3, 2017

Sorry for the late reply, I had a busy week. The main difference between what I've seen in your project and mine is that I added the libopencv_java3.so files for all supported platforms in the jniLibs folder inside my main project. Besides that the structure is the same. Then to instantiate the OpenCV library I added this code to the activity:

    static {
        if(!OpenCVLoader.initDebug()){
            Log.d(TAG, "OpenCV not loaded");
            // mostrar error
        } else {
            Log.d(TAG, "OpenCV loaded");
            connected = true;
        }
    }

And use OpenCV methods normally. As I said in a previous comment I use the org.opencv.android.JavaCameraView extending it to be able to take a picture programatically.

I think that's all, please tell me if you want me to test something, or if you need anything.

@ducpt2
Copy link

ducpt2 commented Nov 4, 2017

@xkraty @beast Can you update the Example? Thank you.

@beast
Copy link
Owner

beast commented Nov 4, 2017

@khrizt @ducpt2 I will have a poke on it when I could free from my daily duty. Currently I am running a startup is experiencing high growth. If anyone got time, feel free to open a pull request. Thanks.

@ducpt2
Copy link

ducpt2 commented Nov 5, 2017

@beast Thank you, I'm waiting for it.
@khrizt Can you open a pull request? Really hope you can fix this. :)

@khrizt
Copy link

khrizt commented Nov 7, 2017

Hi,

Today I've been trying to apply my configuration to this project and so far I have been unsuccessful. I really don't understand what's wrong because gradle can't find OpenCV library in the react-native-scan-doc module, even I have it set up just like my project. I'll try some more today and tomorrow and will let you know.

@khrizt
Copy link

khrizt commented Nov 7, 2017

@beast If I can't make it work, would it be ok for you if I create a new project and set it up again, with newer react and opencv versions and try your code inside?

@ducpt2
Copy link

ducpt2 commented Nov 8, 2017

@khrizt I'm very appreciated your effort. Can you make a video how to set things up? I will learn a lot from this video (like bridge, setup opencv...)? Thank you so much.

@beast
Copy link
Owner

beast commented Nov 8, 2017

@khrizt Actually that was the same problem I was facing. I always had hit and misses when I try on my own. So I was not 100% sure what was wrong. Because as you could tell that my android native one will always certainly work...

@khrizt
Copy link

khrizt commented Nov 8, 2017

@beast There's something there to find out :) I'll try it again soon and try to make some sense of the situation. EDIT: by the way, I found someone who has compiled OpenCV and uploaded to maven, maybe it's something worth trying deeply. I tried with my fork of your project and gave me the same error but that was after 2 hours of struggling with the error we are talking about, so maybe... who knows.

@ducpt2 I found a tutorial for setting up OpenCV with android native that works, has video and article: https://www.learn2crack.com/2016/03/setup-opencv-sdk-android-studio.html

@ducpt2
Copy link

ducpt2 commented Nov 8, 2017

@khrizt oh, many thanks. 👍

@shanwije
Copy link

shanwije commented Nov 9, 2017

@khrizt really thanks for the link, also if anyone wants more details ragarding native android opencv integration: https://stackoverflow.com/questions/27406303/opencv-in-android-studio

@ducpt2
Copy link

ducpt2 commented Nov 27, 2017

Anyone still work on this project?

@nisargrthakkar
Copy link

any update on this?

@khrizt
Copy link

khrizt commented Apr 6, 2018

I've found a opencv react native tutorial that may be of some help, if someone wants to take a look: https://brainhub.eu/blog/opencv-react-native-image-processing/

@biks152207
Copy link

@beast @ducpt2 guys, does this package work?i am also struggling to scan the doc

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

No branches or pull requests

7 participants