0

I'm not exactly sure what caused this or when it occurred but all of imports in MainActivtiy.java were being used successfully without any errors. The app compiled and has been working great. I went back and added some images in my @drawable folder and them added them in my .xml file. Some time after that, every OpenCV class and keyword imported is now an error with "Cannot Resolve Symbol [symbol]." I have tried every suggestion I found with no luck. My app still works, but I can not edit or anything OpenCV keywords.

I was using Android 3.2.0 with OpenCV 3.20, I updated Android Studio to 3.2.1.

Things I have tried, all with no success:

*Everything from this question including

-Delete .idea folder and .iml folder and re-imported project

-Invalidate cache/restart

-Set source and target compatibility to 1.8 for the app and opencv module

-Clean/Rebuild

*Everything from this question that was not repeated

*Update Android Studio

*Remove and re-install opencv

*Close and re-open Android Studio

*Restart computer

What is strange is that everything was fine and then this suddenly happened without much warning. Also, when I click on the OpenCV resources and click on the .java files, they all say "File was loaded in the wrong encoding: UTF-8" and I can't see anything. I followed the steps here when loading OpenCV and whenever I have looked up declarations or anything else in these java files there was no issue. How can I resolve this?

Kyle G
  • 71
  • 10
  • Android Studio sometimes annoys while linking libraries, I would suggest you to copy your code to a new project, integrate OpenCV in that project and get your app working. Debugging and fixing it in same project would cause you more time I guess. – ZdaR Oct 16 '18 at 07:14
  • @ZdaR I'm trying that now but even files in an unedited project are not loading correctly. The colors.xml file has the wrong encoding or something because all of the characters are boxes. This is just from opening a new project and not changing anything – Kyle G Oct 16 '18 at 17:15

1 Answers1

0

I tried a few more things including: -Making a new project and coping the code from the old one over, same issues -Re-installing Android Studio and importing old project, same result.

The only thing that solved my problem was uninstalling Android Studio, then re-installing it and making a new project. I copied the code over and imported the OpenCV module and all the errors went away. I went from version 3.2.0 to 3.2.1 as well

Kyle G
  • 71
  • 10