Skip to content

Conversation

@rebroad
Copy link
Contributor

@rebroad rebroad commented Jan 3, 2026

Problem

Unit tests were failing with UnsatisfiedLinkError when running Robolectric tests. The error occurred when Conscrypt tried to load its native library during test setup.

All 9 tests in FileTransferTest were failing with:

java.lang.UnsatisfiedLinkError: Failed creating temp file (/tmp/libconscrypt_openjdk_jni-linux-x86_64...)
    at org.conscrypt.NativeLibraryLoader.loadFromWorkdir(NativeLibraryLoader.java:205)

Solution

Added the @ConscryptMode(Mode.OFF) annotation to FileTransferTest class. This annotation (available in Robolectric 4.9+) disables Conscrypt and makes Robolectric use BouncyCastle instead, which doesn't require native libraries.

Changes

  • Added @ConscryptMode(ConscryptMode.Mode.OFF) annotation to FileTransferTest
  • Added import for org.robolectric.annotation.ConscryptMode

Testing

  • ✅ All 9 tests in FileTransferTest now pass
  • ✅ Full build (./gradlew build) is successful
  • ✅ No dependency upgrades required (Robolectric 4.15 already supports this annotation)

References

…atisfiedLinkError

Robolectric 4.9+ uses Conscrypt as the default security provider, which
requires native libraries that aren't available in the test environment.
Adding @ConscryptMode(Mode.OFF) disables Conscrypt and uses BouncyCastle
instead, which resolves the test failures.

This fixes the build failures in FileTransferTest where all 9 tests were
failing with UnsatisfiedLinkError when Conscrypt tried to load native
libraries.

Fixes permissionlesstech#542
@callebtc
Copy link
Collaborator

callebtc commented Jan 4, 2026

Thank you!

@callebtc callebtc merged commit 54c96bd into permissionlesstech:main Jan 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unit tests fail with UnsatisfiedLinkError for Conscrypt native library in Robolectric tests

2 participants