Exception while using aspose word(24.12) library in android app

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");
    }
}

@info9599

The exception you are encountering, java.lang.NoClassDefFoundError: Failed resolution of: Lorg/bouncycastle/operator/DefaultAlgorithmNameFinder, typically indicates that a required class from the Bouncy Castle library is missing from your project. This can happen if the library is not included in your dependencies.

To resolve this issue, you should ensure that you have the Bouncy Castle library added to your Gradle dependencies. You can do this by adding the following line to your build.gradle file:

implementation 'org.bouncycastle:bcprov-jdk15on:1.68' // or the latest version

Make sure to sync your project after adding the dependency. This should provide the necessary classes that Aspose.Words relies on.

Additionally, ensure that you are using the correct Aspose.Words library for Android. Your current implementation line looks correct, but just to confirm, it should be:

implementation (group: 'com.aspose', name: 'aspose-words', version: '24.12', classifier: 'android.via.java')

If you continue to experience issues, consider creating a simplified version of your Android project that reproduces the problem and share it for further investigation. This can help in diagnosing the issue more effectively.

If you need further assistance, feel free to ask!

Sources:
[1]: Install Aspose.Words for Android via Java in B2G App via build.gradle Configuration

@info9599

During latest releases we updated bouncycastle library
Can you say about latest working version of Aspose.Words for android?

We can find oldest version of bouncycastle library and use it in awandroid jar

Still getting the same error:

updated gradle file :

implementation (group: 'com.aspose', name: 'aspose-words', version: '24.12', classifier: 'android.via.java')
implementation("org.bouncycastle:bcprov-jdk15on:1.70")

I have sync the project after adding dependency .

Please try I don’t think you library is working for java & android. I have tried your java library as well in eclipse it was not working as well.