I try to make an android client for a server using spring's OAuth2 dependency. The problem is that when I call this constructor:
OAuth2RestTemplate oAuthRestTemplate = new Auth2RestTemplate(resourceDetails);
I get this Exception:
Didn't find class "javax.xml.transform.stax.StAXSource" on path: DexPathList
I use Android Studio which uses gradle and I include the OAuth2 dependency like this:
dependencies {
implementation 'org.springframework.security.oauth:spring-security-oauth2:2.3.0.RC1'
...
}
In a similar question, the accepted answer suggests to include the Spring rest-template dependency (compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
) but when I do this I get another error that I have also posted here.
I believe that the Spring rest-template dependency should not be included because it may already be imported by the Spring OAuth dependency. Is it true? And if it is, how can I solve the fact that another class (javax.xml.transform.stax.StAXSource
) can't be found? I think the reason that this class can't be found is because I am on android which uses its own implementation of JDK as this answer suggests.
If anyone could help me solve this problem, it would be really appreciated.