Build failed in React-Native 0.76.1
- What went wrong: Execution failed for task ':react-native-pdf-thumbnail:compileDebugKotlin'.
A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction Compilation error. See log for more details
More details on error:
Task :react-native-pdf-thumbnail:compileDebugKotlin FAILED e: file:///Users/myuser/Documents/myproject/node_modules/react-native-pdf-thumbnail/android/src/main/java/org/songsterq/pdfthumbnail/PdfThumbnailModule.kt:101:74 Type mismatch: inferred type is Bitmap.Config? but Bitmap.Config was expected
using this patch fixed it for me:
diff --git a/android/src/main/java/org/songsterq/pdfthumbnail/PdfThumbnailModule.kt b/android/src/main/java/org/songsterq/pdfthumbnail/PdfThumbnailModule.kt
index 921b5782b68b06d750795b5f86d63e4ec4bc62e6..3e4aa6b66fcf7544b614f2510bf805d9738a8bd3 100644
--- a/android/src/main/java/org/songsterq/pdfthumbnail/PdfThumbnailModule.kt
+++ b/android/src/main/java/org/songsterq/pdfthumbnail/PdfThumbnailModule.kt
@@ -98,7 +98,7 @@ class PdfThumbnailModule(reactContext: ReactApplicationContext) :
currentPage.close()
// Some bitmaps have transparent background which results in a black thumbnail. Add a white background.
- val bitmapWhiteBG = Bitmap.createBitmap(bitmap.width, bitmap.height, bitmap.config)
+ val bitmapWhiteBG = Bitmap.createBitmap(bitmap.width, bitmap.height, bitmap.config ?: Bitmap.Config.ARGB_8888)
val canvas = Canvas(bitmapWhiteBG)
canvas.drawBitmap(bitmap, 0f, 0f, null)
bitmap.recycle()
Hello @0anw0
Thanks for the patch, this worked for me. Will be nice to see a fix in the next release.
I tried the patch in my expo bareflow project but my build for android failed with this : _
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':react-native-pdf-thumbnail:compileReleaseKotlin'.
A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction Compilation error. See log for more details
_
! WORKS FOR ME ! Try to replace with react-native-pdf-page-image
Merged #82 . Thanks @adniltonsantos !
Hey ! Thanks foe the merge @songsterq but I don't see a new release though ! The latest comes from Nov"23 with version 1.3.1. How can we release a new version ?