Skip to content

Commit

Permalink
Update R8/ProGuard rules to avoid crash in release
Browse files Browse the repository at this point in the history
The following exception in `PDFMergerUtility` happened without the additional keep-rule:

```
java.io.IOException: Error while trying to create value in number tree:com.tom_roush.pdfbox.pdmodel.documentinterchange.logicalstructure.PDParentTreeValue.<init> [class com.tom_roush.pdfbox.cos.COSArray]
     at com.tom_roush.pdfbox.multipdf.PDFMergerUtility.getNumberTreeAsMap(PDFMergerUtility.java:20)
     at com.tom_roush.pdfbox.multipdf.PDFMergerUtility.appendDocument(PDFMergerUtility.java:189)
     at com.tom_roush.pdfbox.multipdf.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:18)
Caused by: java.lang.NoSuchMethodException: com.tom_roush.pdfbox.pdmodel.documentinterchange.logicalstructure.PDParentTreeValue.<init> [class com.tom_roush.pdfbox.cos.COSArray]
     at java.lang.Class.getConstructor0(Class.java:2332)
     at java.lang.Class.getDeclaredConstructor(Class.java:2170)
     at com.tom_roush.pdfbox.multipdf.PDFMergerUtility.getNumberTreeAsMap(PDFMergerUtility.java:16)
```
  • Loading branch information
rzimmer authored and TomRoush committed Nov 30, 2022
1 parent 047207e commit 68ebb4c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions library/consumer-proguard-rules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
-keep,allowobfuscation class * extends com.tom_roush.pdfbox.pdmodel.encryption.SecurityHandler {
public <init>(...);
}

-keep,allowobfuscation class com.tom_roush.pdfbox.pdmodel.documentinterchange.** { *; }

0 comments on commit 68ebb4c

Please sign in to comment.