0

I am implementing the Azure Storage blob library for uploading files to the server. It is working well for debug build but giving issues for the signed build.

If I make minifyEnabled false in the main modules(app) build.gradle file then it works well. Azure dependency is added in one of the modules (utils) of the projects

Below is the error that I am getting.

    R8$$SyntheticClass:19 -> Unhandled Exception
R8$$SyntheticClass:26 -> java.lang.LinkageError: Package versions: jackson-annotations=unknown, jackson-core=unknown, jackson-databind=unknown,
jackson-dataformat-xml=unknown, jackson-datatype-jsr310=unknown, azure-core=1.21.0
at com.azure.core.implementation.jackson.ObjectMapperShim.createXmlMapper(ObjectMapperShim.java:24)
at com.azure.core.util.serializer.JacksonAdapter.<init>(JacksonAdapter.java:6)
at com.azure.core.util.serializer.JacksonAdapter.<init>(JacksonAdapter.java:1)
at com.azure.core.util.serializer.JacksonAdapter.createDefaultSerializerAdapter(JacksonAdapter.java:10)
at g3.g.<clinit>(ModelHelper.java:1)
at g3.g.a(ModelHelper.java:1)
at d3.n.a(BlobUrlParts.java:16)
at le.a.<init>(AzureManager.kt:22)
at wc.s.c(LoggerManager.kt:51)
at wc.c.f(AuthenticationManager.kt:658)
at wc.c$a.j(Unknown Source:11)
at dh.a.d(ContinuationImpl.kt:8)
at sh.k0.run(DispatchedTask.kt:109)
at yh.f.run(LimitedDispatcher.kt:12)
at zh.j.run(Tasks.kt:3)
at zh.a$b.run(CoroutineScheduler.kt:85)
Caused by: java.lang.LinkageError: Method java.io.OutputStream l5.e.j(java.io.OutputStream, k4.b)
overrides final method in class Lh4/e; (declaration of 'l5.e' appears in /data/app/~~eabNHREnGf5V2l7IFfclDA==/com.harman.dht.rcp_watch-TL7eUAKIO8SLVyPKiAm16Q==/base.apk)
at l5.f.r(XmlMapper.java:1)
at com.azure.core.implementation.jackson.ObjectMapperFactory.createXmlMapper(ObjectMapperFactory.java:1)
at com.azure.core.implementation.jackson.ObjectMapperShim.createXmlMapper(ObjectMapperShim.java:3)
at com.azure.core.util.serializer.JacksonAdapter.<init>(JacksonAdapter.java:6) 
at com.azure.core.util.serializer.JacksonAdapter.<init>(JacksonAdapter.java:1) 
at com.azure.core.util.serializer.JacksonAdapter.createDefaultSerializerAdapter(JacksonAdapter.java:10) 
at g3.g.<clinit>(ModelHelper.java:1) 
at g3.g.a(ModelHelper.java:1) 
at d3.n.a(BlobUrlParts.java:16) 
at le.a.<init>(AzureManager.kt:22) 
at wc.s.c(LoggerManager.kt:51) 
at wc.c.f(AuthenticationManager.kt:658) 
at wc.c$a.j(Unknown Source:11) 
at dh.a.d(ContinuationImpl.kt:8) 
at sh.k0.run(DispatchedTask.kt:109) 
at yh.f.run(LimitedDispatcher.kt:12) 
at zh.j.run(Tasks.kt:3) 
at zh.a$b.run(CoroutineScheduler.kt:85)

 

Below it the snippet of Azure dependency in utils modules build.gradle

// Azure
    implementation 'com.azure:azure-storage-blob:12.14.1'
    implementation 'javax.xml.stream:stax-api:1.0-2'

Below isippetst the code snippett of app modules proguard-rule.pro rule files.

-keepattributes SourceFile, LineNumberTable, EnclosingMethod, Exceptions, InnerClasses, Signature, *Annotation*
-keep class androidx.health.services.client.** { *; }
-keep class com.google.android.libraries.healthdata.** { *; }
-keep class net.sqlcipher.** { *; }
-keep class net.sqlcipher.database.** { *; }

-dontwarn com.fasterxml.**
-keep class com.azure.core.**{*;}

Below is the code snippet of app modules consumer-rule.pro files.

-dontwarn com.fasterxml.**
-keep class com.azure.core.**{*;}

Please guide. Thanks in advance.

SaurabhG
  • 173
  • 1
  • 11
  • Minimizing using proguard is always a try-and-error game. You need to identify the used libraries that can not be minimized and/or obfuscated. Based on the error message it is clear that you should try to add Jackson library classes also to the keep list. – Robert Jun 10 '23 at 21:09
  • ``-keep class com.bea.xml.**{*;} -keep class com.fasterxml.**{*;}`` I updated proguard-rule.pro file.. I getting this error. ``R8$$SyntheticClass:19 -> Unhandled Exception E R8$$SyntheticClass:26 -> java.lang.NoClassDefFoundError: v3.g at v3.g.a(ModelHelper.java:1) at s3.n.a(BlobUrlParts.java:16) Caused by: eg.a: Provider com.bea.xml.stream.MXParserFactory not found at eg.b.c(FactoryFinder.java:58) at eg.b.b(FactoryFinder.java:310) at com.fasterxml.jackson.dataformat.xml.XmlFactory.(XmlFactory.java:10)`` – SaurabhG Jun 11 '23 at 05:38
  • @Robert: Can you please elaborate more, what should I check in provided link.? – SaurabhG Jun 12 '23 at 05:26
  • Sorry wrong link posted. See e.g. https://stackoverflow.com/q/56006933/150978 for deobfuscating Stack Trace. – Robert Jun 12 '23 at 06:51
  • This is fixed. By keeping(keep) in proguard rule files, the classes which were giving issue(by checking logs). Thanks all for help. – SaurabhG Jul 06 '23 at 10:50

0 Answers0