Aspose Words - Android > 24.6

Hi,
I’m trying to upgrade from version 24.6 to a more recent version on Android, but I’m getting errors when initializing Aspose on the bouncy fips library.
Project configuration:

  • minSdk 26
  • bouncy → ‘org.bouncycastle:bcprov-jdk18on:1.83’ and ‘org.bouncycastle:bcutil-jdk18on:1.83’

@samuele.lucarini

Aspose.Words for Android – Upgrade & Bouncy‑Castle FIPS Issues

Below is a checklist that usually resolves the errors you see when initialising Aspose.Words after upgrading from 24.6 to a newer version while you are also pulling in the Bouncy‑Castle libraries you listed.


1. Use the Bouncy‑Castle version that Aspose.Words expects

Aspose.Words (Android) Recommended Bouncy‑Castle artifact Reason
24.7‑24.11 (and newer) org.bouncycastle:bcprov-jdk15on:<latest‑1.x> The library is compiled against the JDK 15 API. Using the JDK 18 (bcprov-jdk18on) can cause NoSuchMethodError / ClassNotFoundException at runtime on Android.
FIPS mode (optional) org.bouncycastle:bcprov-fips:<latest‑1.x> and org.bouncycastle:bcpkix-fips:<latest‑1.x> Only needed if you explicitly enable the FIPS provider in your code.

Action

// Remove the JDK‑18 artifacts
// implementation 'org.bouncycastle:bcprov-jdk18on:1.83'
// implementation 'org.bouncycastle:bcutil-jdk18on:1.83'

// Add the supported JDK‑15 artifacts (or the FIPS ones if you need FIPS)
implementation 'org.bouncycastle:bcprov-jdk15on:1.78'   // use the latest 1.x version
implementation 'org.bouncycastle:bcpkix-jdk15on:1.78' // optional – needed for PKIX support

Why?
Aspose.Words for Android bundles a light‑weight copy of the Bouncy‑Castle provider that works with the JDK 15 API. When the runtime resolves the newer JDK 18 classes first (because they are on the class‑path), the provider initialization fails.


2. Disable the transitive BC provider that comes with Aspose (if you want to keep your own version)

If you prefer to keep the Bouncy‑Castle version you supply, you must exclude the one that ships inside Aspose.Words:

implementation ('com.aspose:aspose-words-android:24.12') {
    exclude group: 'org.bouncycastle', module: 'bcprov-jdk15on'
    exclude group: 'org.bouncycastle', module: 'bcpkix-jdk15on'
}

Add the exact version you want after the exclusion (see step 1).


3. ProGuard / R8 keep rules (mandatory for Android releases)

When you shrink/obfuscate, the Bouncy‑Castle classes may be removed or renamed, causing the provider to throw java.security.NoSuchProviderException. Add the following rules to proguard‑rules.pro (or the equivalent R8 file):

# Keep all Bouncy Castle provider classes
-keep class org.bouncycastle.** { *; }
-dontwarn org.bouncycastle.**
# Keep the Aspose.Words security classes that reference BC
-keep class com.aspose.words.security.** { *; }

4. Initialising the provider (only required for explicit FIPS usage)

If you are not using the FIPS provider, do not call Security.addProvider(new BouncyCastleProvider()) – Aspose.Words already registers the bundled provider.

If you are using the FIPS provider, initialise it before any Aspose call:

import org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider;
import java.security.Security;

// Must be the very first line that touches Aspose
Security.addProvider(new BouncyCastleFipsProvider());

// Now you can safely call Aspose APIs
com.aspose.words.Document doc = new com.aspose.words.Document("input.docx");

Make sure the FIPS jars (bcprov-fips and bcpkix-fips) are on the class‑path.


5. Clean & rebuild

  1. Invalidate caches (Android Studio → File → Invalidate Caches / Restart).
  2. Delete the build folder of the module (./gradlew clean).
  3. Re‑run the project (./gradlew assembleDebug).

Frequently Reported Errors & Their Fixes

Symptom Typical cause Fix
java.lang.NoSuchMethodError: org.bouncycastle.crypto.digests.SHA256Digest.<init>()V Using bcprov-jdk18on with Aspose compiled against JDK 15 Switch to bcprov-jdk15on
java.security.NoSuchProviderException: BouncyCastle FIPS FIPS provider not added or missing bcprov-fips jar Add the FIPS provider (step 4) and the correct artifacts
ClassNotFoundException: org.bouncycastle.util.Arrays after ProGuard R8 stripped Bouncy‑Castle utilities Add keep rules (step 3)
java.lang.IllegalStateException: Could not initialize BouncyCastle Both JDK 15 and JDK 18 providers present causing class‑loader conflict Exclude the unwanted BC module (step 2)

Next Steps for You

  1. Replace the JDK 18 Bouncy‑Castle dependencies with JDK 15 (or FIPS) as shown in step 1.
  2. Add the ProGuard keep rules if you use code shrinking.
  3. Perform a clean rebuild and test the application.

If you still encounter an error, please post the exact stack‑trace (including the first Aspose‑related line) and the Aspose.Words version you upgraded to. With that information we can pinpoint any remaining incompatibility.


Helpful Links

Feel free to let us know if any of the steps need clarification or if the problem persists after applying them. We’re happy to help you get the upgrade running smoothly!

Dependency :

implementation ('com.aspose:aspose-words:24.12:android.via.java') {
    exclude group: 'org.bouncycastle', module: 'bcprov-jdk15on'
    exclude group: 'org.bouncycastle', module: 'bcpkix-jdk15on'
}

Bouncy:

implementation 'org.bouncycastle:bcprov-jdk18on:1.83'
implementation 'org.bouncycastle:bcutil-jdk18on:1.83'

StackTrace:

2025-12-01 09:04:25.563  8042-8119  AndroidRuntime          com.maggioli.conciliaevomobile       E  FATAL EXCEPTION: pool-3-thread-1 (Ask Gemini)
Process: com.maggioli.conciliaevomobile, PID: 8042
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.zzRQ.zzYx(Unknown Source:152)
    at com.aspose.words.internal.zzI6.zzW(Unknown Source:22)
    at com.aspose.words.zzYGJ.zzX(Unknown Source:1030)
    at com.aspose.words.zzYGJ.zzY(Unknown Source:142)
    at com.aspose.words.zzYGJ.zzZ(Unknown Source:119)
    at com.aspose.words.zzZ47.zzZ(Unknown Source:848)
    at com.aspose.words.zzZ47.zzM(Unknown Source:835)
    at com.aspose.words.zzZ47.zzS(Unknown Source:691)
    at com.aspose.words.zzZ47.zzT(Unknown Source:449)
    at com.aspose.words.License.setLicense(Unknown Source:364)
    at com.maggioli.utils.AsposeUtil.lambda$setAsposeLicense$0(AsposeUtil.java:20)
    at com.maggioli.utils.AsposeUtil$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:920)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.bouncycastle.operator.DefaultAlgorithmNameFinder" on path: DexPathList[[zip file "/data/app/~~yXRb6Be5lTStM23xP514ww==/com.maggioli.conciliaevomobile-9KNMB-PUDZoR6zeuG471Yg==/base.apk"],nativeLibraryDirectories=[/data/app/~~yXRb6Be5lTStM23xP514ww==/com.maggioli.conciliaevomobile-9KNMB-PUDZoR6zeuG471Yg==/lib/arm64, /data/app/~~yXRb6Be5lTStM23xP514ww==/com.maggioli.conciliaevomobile-9KNMB-PUDZoR6zeuG471Yg==/base.apk!/lib/arm64-v8a, /system/lib64, /system/system_ext/lib64]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    at com.aspose.words.internal.zzRQ.<clinit>(Unknown Source:851) 
    at com.aspose.words.internal.zzRQ.zzYx(Unknown Source:152) 
    at com.aspose.words.internal.zzI6.zzW(Unknown Source:22) 
    at com.aspose.words.zzYGJ.zzX(Unknown Source:1030) 
    at com.aspose.words.zzYGJ.zzY(Unknown Source:142) 
    at com.aspose.words.zzYGJ.zzZ(Unknown Source:119) 
    at com.aspose.words.zzZ47.zzZ(Unknown Source:848) 
    at com.aspose.words.zzZ47.zzM(Unknown Source:835) 
    at com.aspose.words.zzZ47.zzS(Unknown Source:691) 
    at com.aspose.words.zzZ47.zzT(Unknown Source:449) 
    at com.aspose.words.License.setLicense(Unknown Source:364) 
    at com.maggioli.utils.AsposeUtil.lambda$setAsposeLicense$0(AsposeUtil.java:20) 
    at com.maggioli.utils.AsposeUtil$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
    at java.lang.Thread.run(Thread.java:920) 

i try this :

implementation ('com.aspose:aspose-words:25.9:android.via.java') {
    exclude group: 'org.bouncycastle', module: 'bcprov-jdk15on'
    exclude group: 'org.bouncycastle', module: 'bcpkix-jdk15on'
}

Now i have this error :

java.lang.VerifyError: Verifier rejected 
class com.aspose.words.License: void com.aspose.words.License.<init>() failed to verify: void com.aspose.words.License.<init>(): [0x6] Constructor returning without calling superclass constructor (declaration of 'com.aspose.words.License' appears in /data/app/~~xtLLQaODBrXodR3Qu5vMMA==/com.maggioli.conciliaevomobile-M2OlKfyTjAqpScEfMeOf6Q==/base.apk!classes20.dex)
at com.maggioli.utils.AsposeUtil.setAsposeLicense(AsposeUtil.java:19)
at com.maggioli.utils.ConciliaApplication.onCreate(ConciliaApplication.java:90)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1211)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7588)
at android.app.ActivityThread.access$1700(ActivityThread.java:315)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2286)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8751)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

Hi @samuele.lucarini

Usually we have bc-fips library included in our library and we use several method from that to check License.

Can you check that

implementation ('com.aspose:aspose-words:25.9:android.via.java')

Work then you not add another bc-fips library

//implementation 'org.bouncycastle:bcprov-jdk18on:1.83'
//implementation 'org.bouncycastle:bcutil-jdk18on:1.83'

it looks that adding another bouncycastle library interfered with existing bc-fips library and cause error.