Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/preference/PreferenceManager;

Open
#76 7 comments 12 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
android, java

Research direction

Start at VendorIdentifier.getOrCreate in VendorIdentifier.java and the initialization path in TrustKit.java, using the reported TrustKit.initializeWithNetworkSecurityConfiguration call as the entry point. Reproduce the failure on the stated Android configuration and trace the missing androidx/preference/PreferenceManager resolution. Done means initialization no longer throws NoClassDefFoundError while preserving the reported SSL-pinning setup.

Written by the indexing model from the issue text.

Description

Describe the bug
Below exception is thrown when I init the trust kit for android using below line
TrustKit.initializeWithNetworkSecurityConfiguration(context)
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/preference/PreferenceManager;
at com.datatheorem.android.trustkit.utils.VendorIdentifier.getOrCreate(VendorIdentifier.java:24)
at com.datatheorem.android.trustkit.TrustKit.(TrustKit.java:209)
at com.datatheorem.android.trustkit.TrustKit.initializeWithNetworkSecurityConfiguration(TrustKit.java:321)
at com.datatheorem.android.trustkit.TrustKit.initializeWithNetworkSecurityConfiguration(TrustKit.java:271)

To Reproduce
There are no steps just the init line causes this issue and this issue has nothing to do with network_security_config and thats added under application tag in app's manifest and in xml directory under res.
The pattern for my base url is added and I am using 64 char length pinset.
My network config is below for ref.

Expected behavior
I want to implement SSL pinning for Android 21 and above.

TrustKit configuration
<?xml version="1.0" encoding="utf-8"?> <network-security-config> <domain-config cleartextTrafficPermitted="false"> <domain includeSubdomains="true">abcd.abcd-abcd.com</domain> <pin-set> <pin digest="SHA-256">XXX</pin> <pin digest="SHA-256">XXX</pin> <pin digest="SHA-256">XXX</pin> </pin-set> <trustkit-config enforcePinning="true" /> </domain-config> </network-security-config>

App details:

  • App target SDK: 30
  • App Min SDK: 21
  • App language: Java, Kotlin
  • Android R or API 30 (Tested on pixel 2 emulator)
Dominant language
Java
Stars
604
Forks
90
Avg merge
1h 29m
Merged PRs (30d)
2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from datatheorem/TrustKit-Android

All issues in datatheorem/TrustKit-Android

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.