I have a database on sqlite
on Android, and export report to pdf
using the itextpdf
library.
But recently after updating the Android SDK, it started from the error line below:
Document document = new Document();
The error that occurs:
Caused by: java.lang.NoClassDefFoundError: com.itextpdf.text.Document
I did not modify the class, I only upgraded the version of SDK 22 to SDK 23.
I'm having this problem on devices prior to Android 5.0. From version 5 onwards it 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 for what it might be?