java.lang.ClassNotFoundException: Didn't find class "cz.msebera.android.httpclient.client.utils.URIBuilder"

이 현무 20 Reputation points
2024-09-26T05:48:25.6833333+00:00

The app crash when create an MSAL PublicClientApplication

  • Device: All Device
  • Android Version: All Version
  • Browser: None
  • MSAL Version: 4.9.+

java.lang.NoClassDefFoundError: Failed resolution of: Lcz/msebera/android/httpclient/client/utils/URIBuilder; at com.microsoft.identity.client.PublicClientApplicationConfigurationFactory.getGsonForLoadingConfiguration(PublicClientApplicationConfigurationFactory.java:180) at com.microsoft.identity.client.PublicClientApplicationConfigurationFactory.loadConfiguration(PublicClientApplicationConfigurationFactory.java:167) at com.microsoft.identity.client.PublicClientApplicationConfigurationFactory.loadConfiguration(PublicClientApplicationConfigurationFactory.java:120) at com.microsoft.identity.client.PublicClientApplicationConfigurationFactory.initializeConfiguration(PublicClientApplicationConfigurationFactory.java:71) at com.microsoft.identity.client.PublicClientApplication$6.run(PublicClientApplication.java:655) at java.lang.Thread.run(Thread.java:1012) Caused by: java.lang.ClassNotFoundException: Didn't find class "cz.msebera.android.httpclient.client.utils.URIBuilder" on path: DexPathList[[zip file "/data/app/~~IuyARbxH0R4JtJceSzBiWQ==/kr.co.ksystem.forms-Wt8YcaKLcqOkwcC2YN8fCA==/base.apk"],nativeLibraryDirectories=[/data/app/~~IuyARbxH0R4JtJceSzBiWQ==/kr.co.ksystem.forms-Wt8YcaKLcqOkwcC2YN8fCA==/lib/arm64, /data/app/~~IuyARbxH0R4JtJceSzBiWQ==/kr.co.ksystem.forms-Wt8YcaKLcqOkwcC2YN8fCA==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259) at java.lang.ClassLoader.loadClass(ClassLoader.java:637) at java.lang.ClassLoader.loadClass(ClassLoader.java:573) at com.microsoft.identity.client.PublicClientApplicationConfigurationFactory.getGsonForLoadingConfiguration(PublicClientApplicationConfigurationFactory.java:180)  at com.microsoft.identity.client.PublicClientApplicationConfigurationFactory.loadConfiguration(PublicClientApplicationConfigurationFactory.java:167)  at com.microsoft.identity.client.PublicClientApplicationConfigurationFactory.loadConfiguration(PublicClientApplicationConfigurationFactory.java:120)  at com.microsoft.identity.client.PublicClientApplicationConfigurationFactory.initializeConfiguration(PublicClientApplicationConfigurationFactory.java:71)  at com.microsoft.identity.client.PublicClientApplication$6.run(PublicClientApplication.java:655)  at java.lang.Thread.run(Thread.java:1012) 

It looks the same as the issue in the link below.

https://github.com/AzureAD/microsoft-authentication-library-for-android/discussions/1797

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
21,904 questions
0 comments No comments
{count} votes

Accepted answer
  1. James Hamil 24,841 Reputation points Microsoft Employee
    2024-10-02T21:32:55.7766667+00:00

    Hi @이 현무 , the URIBuilder class is missing from your app's classpath.

    This is caused by a conflict between the version of the Apache HttpClient library that is included in MSAL and the version of the library that is included in your app.

    Try excluding the Apache HttpClient library from the MSAL dependency in your app's build.gradle file, like so:

    implementation ('com.microsoft.identity.client:msal:2.+') { exclude group: 'cz.msebera.android', module: 'httpclient' }
    

    This should exclude the Apache HttpClient library from the MSAL dependency and allow your app to use the version of the library that is included in your app's classpath.

    Please let me know if you have any questions and I can help you further.

    If this answer helps you please mark "Accept Answer" so other users can reference it.

    Thank you,

    James

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.