Luca96 / android-face-landmarks

Android app that localizes facial landmarks in nearly real-time
MIT License
68 stars 27 forks source link

Some compiling errors: "unresolved reference" and "await suspension" #18

Open Mik-el opened 2 years ago

Mik-el commented 2 years ago

Hi, I correctly replaced the 2 paths in the "CMakeLists.txt" but the build fails for these errors:

1) Class CameraActivity.kt, line 280. "The 'await' suspension point is inside a critical section" 2) Class CameraActivity.kt, line 218. "Unresolved reference: maxBy" and "Unresolved reference: it" 3) Class CameraUtil.kt, line 66. "Unresolved reference: maxBy" and "Unresolved reference: it"

I'm new to Kotlin syntax, how can I solve them?

Thanks in advance

Mik-el commented 2 years ago

Ok, I solved the 2nd and 3rd error. Initially I replaced the "maxBy" method with "maxByOrNull". But then I deleted the Android studio project, I reimported it and the maxBy error was solved.

The first error is still here... I coded a workaround (with the delay() method) but when the app "loses" the first detected face and detects the second one, it crashes

Luca96 commented 2 years ago

Hi @Mik-el, sorry for the late response but I'm a bit busy..

Anyway, good that you managed to solve issue 2 and 3. Following this answer, you can try to use a Mutex instead of the ReentrantLock, just change this line.

It's been a few years that I'm not anymore into Kotlin/Android development, so I may be not able to fully help you... Let me know how it goes