react-native-pdf-thumbnail icon indicating copy to clipboard operation
react-native-pdf-thumbnail copied to clipboard

Build failed in React-Native 0.76.1

Open aron-skaleet opened this issue 1 year ago • 3 comments

  • 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

aron-skaleet avatar Nov 10 '24 20:11 aron-skaleet

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()

0anw0 avatar Nov 26 '24 12:11 0anw0

Hello @0anw0

Thanks for the patch, this worked for me. Will be nice to see a fix in the next release.

palmtown avatar Jan 01 '25 09:01 palmtown

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

_

justpeny avatar Feb 23 '25 20:02 justpeny

! WORKS FOR ME ! Try to replace with react-native-pdf-page-image

Sworzen1 avatar Jun 03 '25 09:06 Sworzen1

Merged #82 . Thanks @adniltonsantos !

songsterq avatar Jun 30 '25 03:06 songsterq

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 ?

celestial-rose avatar Sep 04 '25 12:09 celestial-rose