Compilation error after integrating PDFTron SDK

Product: Native Android SDK

Product Version: 9.2.2 and 9.2.3

Please give a brief summary of your issue:
Compilation error after integrating PDFTron SDK.

Please describe your issue and provide steps to reproduce it:
Repro steps:

  1. Setup the gradle files with PDFTron dependencies and private repo
  2. Build or hit Run in Android Studio

Result: Get these errors:

values.xml. Cause: java.lang.IllegalStateException: Can not add resource (com.android.aaptcompiler.ParsedResource@50082638) to table.). Check logs for more details.
Failed to compile values resource file /Users/seth/Projects/canopy/mobile/android/canopy/app/build/intermediates/incremental/clientDebug/mergeClientDebugResources/merged.dir/values/values.xml
Caused by: java.lang.IllegalStateException: Can not add resource (com.android.aaptcompiler.ParsedResource@50082638) to table.

Workaround: Use the AAR integration instead of gradle or use gradle integration referencing 9.2.1. Issue is introduced in 9.2.2 and continues in 9.2.3

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

I was able to replicate with the manual AAR integration as well. By updating the material library I get the same error.

Updating from 1.4.0 to 1.6.1:
implementation 'com.google.android.material:material:1.6.1'

Reverting back to material 1.4.0 works again:
implementation 'com.google.android.material:material:1.4.0'

Seems as though the PDFTron SDK isn’t updated to work with updated material library. That may be why I can’t integrate using Gradle Dependencies?

Hi Seth,

Could you let us know what your projects targetSDKVersion and compileSdkVersion is?

Best,
Eamon

compileSdk = 31
targetSdk = 31

Hi,

We have found the solution to the issue you were having.
It appears that Material 1.5.0 added in a resource called dividerThickness and in your project you also define your own resource called dividerThickness.
If you remove the your dividerThickness attribute from attrs.xml and it’s references, the project library will compile and run even with material:1.5.0

Best,
Eamon

1 Like

We have implemented that solution. Thank you!

1 Like

This error usually occurs whenever You are using some special character in your native files especially if you are using ! or directly then you will face this type of error. You have to use a backslash while you are using it ! or

'  #❎ Dont use this
\' #✅ this is Right

Or You are using ! then

!  #❎ Dont use this
\! #✅ this is Right

And now your error will be solved. You can Read More about this error at here.