OpenFTC / EasyOpenCV

Finally, a straightforward and easy way to use OpenCV on an FTC robot!
215 stars 95 forks source link

ERROR: package does not exist #9

Closed Alexejhero closed 4 years ago

Alexejhero commented 4 years ago

I am trying to install EasyOpenCV on a control hub. When I try to build it, the following error appears:

Building........................BUILD FAILED
org/firstinspires/ftc/teamcode/autonomous/RED.java(9:23): ERROR: package org.opencv.core does not exist
org/firstinspires/ftc/teamcode/autonomous/RED.java(14:26): ERROR: package org.opencv.imgproc does not exist
org/firstinspires/ftc/teamcode/autonomous/RED.java(15:30): ERROR: package org.openftc.easyopencv does not exist

I followed all of the instructions in the README file, and I did copy the .so file to the FIRST folder.

Are there special steps that need to be taken for a control hub?

Windwoes commented 4 years ago

Did you perform a Gradle sync after editing the Gradle files? If so, did it succeed?

Alexejhero commented 4 years ago

I am using a control hub.

Alexejhero commented 4 years ago

Oh, do I need to build the app with the edited gradle files on the control hub?

Alexejhero commented 4 years ago

Wait, i'm dumb. I'm using a control hub with the ftc_http library, which makes it possible to upload code to the control hub directly from android studio. I did follow the instructions, but I added the EasyOpenCV library to Android Studio, and not the control hub

Windwoes commented 4 years ago

Yeah, EasyOpenCV is not compatible OnBotJava (which is what ftc_http uses) without some extra work.

Windwoes commented 4 years ago

FYI, you can use ADB over network to upload the full app from Android Studio wirelessly, and using OpenRC-Turbo can make that process a nice bit faster than the stock SDK.

Alexejhero commented 4 years ago

Yeah, EasyOpenCV is not compatible OnBotJava (which is what ftc_http uses) without some extra work.

How can I do that? I connected the control hub via ADB and built the app, but OnBotJava still says that there is a package missing.

Windwoes commented 4 years ago

I played around with this a while ago... IIRC after building the app with EasyOpenCV using Android Studio, the only other thing you had to do to make it work with OnBot was copy the sources JAR (of same version) into OnBot's lib folder.

Please note that this is currently an unsupported way of using EasyOpenCV and I can't guarantee that you won't run into issues that you might not otherwise!

Assuming you built the app from Android Studio using EasyOpenCV v1.3.2, then you will need to download easyopencv-1.3.2-sources.jar and put it in the FIRST/java/lib folder on the internal storage of your Control Hub.

Alexejhero commented 4 years ago

I added the file to the control hub as you specified, but the same error still occurs.

Alexejhero commented 4 years ago

I installed the app on the control hub with the opmodes in it, and it worked with opencv. The reason why we use OnBotJava is because the build time is the smallest and the install time is 0. This is very helpful when making small changes to autonomous opmodes.

Windwoes commented 4 years ago

Just to make sure you put it in the right place, there should have been two JARs already in that folder, android.jar and onbotjava-classes.jar correct?

Alexejhero commented 4 years ago

Yep

Windwoes commented 4 years ago

Oh hmm I think I gave you the wrong file. I think it wants a compiled JAR not a sources JAR.

Windwoes commented 4 years ago

Ok, try deleting the file I gave you before, and putting this one in there instead: https://drive.google.com/open?id=1dScdAYt6e_EbG2B3anDjVdIK9bPHCEnY

Alexejhero commented 4 years ago
org/firstinspires/ftc/teamcode/autonomous/RED.java(9:23): ERROR: package org.opencv.core does not exist
org/firstinspires/ftc/teamcode/autonomous/RED.java(14:26): ERROR: package org.opencv.imgproc does not exist

But now there is no error for org.opencv.easyopencv

Windwoes commented 4 years ago

Oh right, how could I forget, you also need the JAR for plain old OpenCV too. Here you go: opencv-repackaged-4.1.0-B-classes-compiled.jar. (Just copy it into that same folder as well).

Aaaand this is one of the reasons why OnBot isn't officially supported, lol........

Alexejhero commented 4 years ago

Thank you very much! It might be helpful for other people if there was a wiki page for onbotjava installation instructions :)

Windwoes commented 2 years ago

FYI, EOCV 1.5.0 now has official support for OnBotJava.