ibitcy / react-native-hole-view

✂️ React-Native component to cut a touch-through holes anywhere you want. Perfect solution for tutorial overlay
398 stars 24 forks source link

Execution failed for task ':react-native-hole-view:compileDebugKotlin'. #34

Open KarkG opened 3 months ago

KarkG commented 3 months ago

I am using this package in my Expo managed project.

When creating a build for Android using eas build -p android --profile development, the build fails with these logs:

...
> Task :react-native-hole-view:compileDebugKotlin FAILED
e: file:///home/expo/workingdir/build/project/node_modules/react-native-hole-view/android/src/main/java/com/ibitcy/react_native_hole_view/RNHoleView.kt:183:5 'onDraw' overrides nothing
e: file:///home/expo/workingdir/build/project/node_modules/react-native-hole-view/android/src/main/java/com/ibitcy/react_native_hole_view/RNHoleView.kt:184:22 Type mismatch: inferred type is Canvas? but Canvas was expected
e: file:///home/expo/workingdir/build/project/node_modules/react-native-hole-view/android/src/main/java/com/ibitcy/react_native_hole_view/RNHoleView.kt:190:5 'dispatchDraw' overrides nothing
e: file:///home/expo/workingdir/build/project/node_modules/react-native-hole-view/android/src/main/java/com/ibitcy/react_native_hole_view/RNHoleView.kt:191:28 Type mismatch: inferred type is Canvas? but Canvas was expected
...
...
...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-hole-view:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

Any suggestions as to how to fix this?

SarjuHansaliya commented 3 months ago

@KarkG till author fixes this issue, you can use this patch

diff --git a/node_modules/react-native-hole-view/android/src/main/java/com/ibitcy/react_native_hole_view/RNHoleView.kt b/node_modules/react-native-hole-view/android/src/main/java/com/ibitcy/react_native_hole_view/RNHoleView.kt
index 7edbfeb..78eafc1 100644
--- a/node_modules/react-native-hole-view/android/src/main/java/com/ibitcy/react_native_hole_view/RNHoleView.kt
+++ b/node_modules/react-native-hole-view/android/src/main/java/com/ibitcy/react_native_hole_view/RNHoleView.kt
@@ -180,14 +180,14 @@ class RNHoleView(context: Context) : ReactViewGroup(context) {
         mHoles.addAll(holes)
     }

-    override fun onDraw(canvas: Canvas?) {
+    override fun onDraw(canvas: Canvas) {
         super.onDraw(canvas)
         if (mHolesPath != null) {
             canvas?.drawPath(mHolesPath!!, mHolesPaint)
         }
     }

-    override fun dispatchDraw(canvas: Canvas?) {
+    override fun dispatchDraw(canvas: Canvas) {
         super.dispatchDraw(canvas)
         if (mHolesPath != null) {
             canvas?.drawPath(mHolesPath!!, mHolesPaint)