To package all dependencies of my Library into .aar file, I have used https://github.com/kezong/fat-aar-android and I am able to see all dependencies in libs folder of .aar file (checked by extracting it). But when I used resulting .aar file in sample project, I am getting below build error:
Execution failed for task ':app:checkDebugDuplicateClasses'.
Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Failed to transform MyMobileSDK-debug-.aar (:MyMobileSDK-debug:) to match attributes {artifactType=enumerated-runtime-classes, org.gradle.status=integration, org.gradle.usage=java-runtime}. > Execution failed for AarToClassTransform: /home/abhishek.kumar/AndroidStudioProjects/sdk-api-android/app/libs/MyMobileSDK-debug.aar. > duplicate entry: META-INF/versions/9/module-info.class
Any help or guidance will be well appreciated. Thanks.
I have figured out the third party open source library behind my issue: com.squareup.okhttp3:logging-interceptor:4.9.1
I have used 'transitive = false' to resolve issue.
embed ("com.squareup.okhttp3:logging-interceptor:4.9.1") { transitive = false }
Thanks Jeroen Mols for the wonderful blog (https://jeroenmols.com/blog/2020/11/11/library-dependencies/)