Getting following exception while trying to use aspose word library in android app:
java.lang.NoClassDefFoundError: Failed resolution of: Lorg / bouncycastle /operator /DefaultAlgorithmNameFinder;
at com.aspose.words.internal.zzRQ.< clinit > (Unknown Source: 851)
at com.aspose.words.internal.zzX3.< init > (Unknown Source: 62)
at com.aspose.words.internal.zzX3.< init > (Unknown Source: 51)
at com.aspose.words.internal.zzX3.< clinit > (Unknown Source: 133)
at com.aspose.words.internal.zzI6.zzZZ(Unknown Source: 87)
at com.aspose.words.zzYTU.zzXX(Unknown Source: 251)
at com.aspose.words.zzZWN.zzZ(Unknown Source: 173)
at com.aspose.words.zzZWN.zzZN(Unknown Source: 139)
at com.aspose.words.zzZWN.zzE(Unknown Source: 41)
at com.aspose.words.zzZWY.zzI8(Unknown Source: 68)
at com.aspose.words.zzZW2.zzZiD(Unknown Source: 152)
at com.aspose.words.zzZW2.zzI8(Unknown Source: 104)
at com.aspose.words.zzYM7.zzI8(Unknown Source: 33)
at com.aspose.words.Document.zzY(Unknown Source: 1955)
at com.aspose.words.Document.zzZ(Unknown Source: 1858)
at com.aspose.words.Document.< init > (Unknown Source: 316)
at com.aspose.words.Document.< init > (Unknown Source: 283)
at com.aspose.words.Document.< init > (Unknown Source: 292)
Gradle file
allprojects {
repositories {
mavenCentral()
google()
maven { url "https://repository.aspose.com/repo/" }
}
}
implementation (group: 'com.aspose', name: 'aspose-words', version: '24.12', classifier: 'android.via.java')
code:
public static void convert(){
try {
InputStream stream = ViewerApplication.getApplicationInstance().getAssets().open("raw/noc.docx");
File file = new File(ConFileUtil.PDF_PATH);
String fileP = file.getAbsolutePath() + File.separator + "noc.pdf";
Document doc = new Document(stream);
doc.save(fileP);
} catch (Exception e) {
e.printStackTrace();
LogUtil.i("tag", "exception");
}
}