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

Can't build the app

Open arcvlad opened this issue 11 months ago • 2 comments

Can not build the app with react-native version 0.76.6, error going on:

> Task :app:compileReleaseJavaWithJavac
FAILED
/home/expo/workingdir/build/StickerSmash/android/app/build/generated/autolinking/src/main/java/com/facebook/react/PackageList.java:16: error: cannot find symbol
import com.pdfthumbnail.PdfThumbnailPackage;
                       ^
  symbol:   class PdfThumbnailPackage
  location: package com.pdfthumbnail
/home/expo/workingdir/build/StickerSmash/android/app/build/generated/autolinking/src/main/java/com/facebook/react/PackageList.java:63: error: cannot find symbol
      new PdfThumbnailPackage()
          ^
  symbol:   class PdfThumbnailPackage
  location: class PackageList

Patch is applied to fix previous error mentioned in issues:

diff --git a/node_modules/react-native-pdf-thumbnail/android/src/main/java/org/songsterq/pdfthumbnail/PdfThumbnailModule.kt b/node_modules/react-native-pdf-thumbnail/android/src/main/java/org/songsterq/pdfthumbnail/PdfThumbnailModule.kt
index 921b578..3e4aa6b 100644
--- a/node_modules/react-native-pdf-thumbnail/android/src/main/java/org/songsterq/pdfthumbnail/PdfThumbnailModule.kt
+++ b/node_modules/react-native-pdf-thumbnail/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()

arcvlad avatar Jan 28 '25 16:01 arcvlad

Same issue.. Not able to build app @songsterq

Arjit0762 avatar Jan 30 '25 12:01 Arjit0762

same issue with react-native: "0.76.7". Patch doesn't work

justpeny avatar Feb 25 '25 00:02 justpeny

Use this package: react-native-pdf-to-image

suprith-lumber avatar Apr 14 '25 11:04 suprith-lumber

Ok.. I have resolved it.. For new versions of react native, it is compulsory to have same "namespace" as mentioned in AndroidManifest.xml file

I have attached a patch file.. Anyone facing the issue can use this patch file to successfully build its project

react-native-pdf-thumbnail+1.3.1.patch

@justpeny @songsterq @arcvlad

Arjit0762 avatar Apr 24 '25 17:04 Arjit0762

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

Sworzen1 avatar Jun 03 '25 09:06 Sworzen1