2
I have a database on sqlite
on Android, and export report to pdf
using the library itextpdf
.
But recently after updating the Android SDK, it started from the error in the line below:
Document document = new Document();
The error that occurs:
Caused by: java.lang.Noclassdeffounderror: com.itextpdf.text.Document
I didn’t change the class, I just upgraded the version of SDK 22 to SDK 23.
I’m having this problem on devices prior to Android 5.0. Version 5 onwards works normally.
Before:
dependencies {
compile 'com.itextpdf:itextpdf:5.5.8'
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services:7.5.0'
}
Now:
defaultConfig {
multiDexEnabled true
}
android {
useLibrary 'org.apache.http.legacy'
}
dependencies {
compile 'com.itextpdf:itextpdf:5.5.8'
compile 'com.android.support:support-v4:23.2.1'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.google.android.gms:play-services:8.4.0'
}
Does anyone have any suggestions of what might be?
Welcome to sopt. Your question is somewhat incomprehensible, a lot of code mixed with loose texts, it is difficult to understand. First explain what is.
– user28595
This problem started to appear after I upgraded the sdk to 23, I use asynctask to call in the background, but it gives error. Strange that it’s only on some devices. The same code worked well before, I did the debug apk test and the only one that worked at all was the one that used sdk 22
– Thiago P
I have two device for testing, one with version 5.1 that works normally is one with version 4.3 that stopped generating the pdf. I haven’t tried it in the emulator because if it worked before, it might be something with sdk I don’t know, I’m a beginner in Java programming. And I have no idea where to start.
– Thiago P
I gave an improved question to make it easier for people to understand, any additional information they find necessary, just edit the question.
– user28595
Thank you Diego, it’s the first time I put something on, because I couldn’t find a solution.
– Thiago P