C:\Smartto2025\SmartoMobile\node_modules\react-native-pdf\android\src\main\java\org\wonday\pdf\PdfView.java:151: error: cannot access PdfDocument
event.putString("message", "loadComplete|"+numberOfPages+"|"+width+"|"+height+"|"+gson.toJson(this.getTableOfContents()));
^
bad class file: C:\Users\djera\.gradle\caches\transforms-3\4536c8043e3ff081e09b388e9ee26365\transformed\jetified-pdfiumandroid-1.0.24-api.jar(/io/legere/pdfiumandroid/PdfDocument.class)
class file has wrong version 61.0, should be 55.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
Loading

Eliana BlakePosted May 11, 2025, 4:25 AM
The error message you are encountering in your React Native project suggests a compatibility issue with the PdfDocument class version. Specifically, it indicates that the PdfDocument class in the jetified-pdfiumandroid-1.0.24-api.jar is compiled with Java version 61.0, while it should be compiled with version 55.0. This discrepancy in Java versions is causing the build to fail.
To resolve this issue, you can try the following steps:
1. Update Java Version: Make sure that the Java version used to compile the PdfDocument class matches the expected version (55.0). You may need to adjust your Gradle settings to target the correct Java version.
2. Clean Gradle Cache: It appears that the PdfDocument class is cached in the Gradle cache directory. Try cleaning your Gradle cache by running the following command:
3. Rebuild Project: After cleaning the Gradle cache, rebuild your project to ensure that the correct PdfDocument class version is accessed.
4. Check Dependencies: Verify that there are no conflicting dependencies in your project that might be causing the PdfDocument class to be compiled with the wrong Java version.
By following these steps, you should be able to resolve the error related to the incorrect Java version for the PdfDocument class. This should allow your React Native project to build successfully and run without any issues. Let me know if you need further assistance or clarification on any of these steps!
Jerald Jayaraj DPosted May 11, 2025, 4:45 AM
* What went wrong:
A problem occurred configuring project ':react-native-gradle-plugin'.
> java.util.concurrent.ExecutionException: org.gradle.api.GradleException: Failed to create Jar file C:\Users\djera\.gradle\caches\jars-9\196b729407d7fbb2907378f4b4c34b5a\kotlin-gradle-plugin-1.6.10.jar.
now getting this error