1

I have enable minifyEnabled to true but after that i am not able to generate signed apk.

It shows warning and error:

Warning:com.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry
Warning:okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning:okio.Okio: can't find referenced class java.nio.file.Files
Warning:okio.Okio: can't find referenced class java.nio.file.Path
Warning:okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning:okio.Okio: can't find referenced class java.nio.file.Path
Warning:okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning:okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning:okio.Okio: can't find referenced class java.nio.file.Path
Warning:okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning:okio.Okio: can't find referenced class java.nio.file.Path
Warning:okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning:okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning:retrofit2.Platform$Java8: can't find referenced method 'boolean isDefault()' in library class java.lang.reflect.Method
Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandles$Lookup
Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandle
Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandles
Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandle
Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandles$Lookup
Warning:retrofit2.Platform$Java8: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning:there were 27 unresolved references to classes or interfaces.
Warning:there were 1 unresolved references to library class members.
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> Job failed, see logs for details

Now when i have set minifyEnabled to false then it will allow me to generate signed apk but i want to set set it to true.

How can i solved this ?

  • Please see as to how are you configuring your Proguard as to if any library is causing an issue. Check this https://stackoverflow.com/questions/33589318/error-building-apk-when-minifyenabled-true – Kartik Shandilya Jul 16 '17 at 08:46

2 Answers2

0

This is an issue with okio and proguard.

Follow this link for detailed explanation But in short, it seems like you need to add those lines to proguard-rules file in your project.

-dontwarn okhttp3.**
-dontwarn okio.**
ApriOri
  • 2,618
  • 29
  • 48
  • Also see this post https://stackoverflow.com/questions/36737073/how-to-fix-warning-cant-find-referenced-class-in-android-eclipse-proguard-rul/37745414#37745414 – ApriOri Jul 16 '17 at 12:23
  • i have defined : `-keep class com.fasterxml.jackson.databind.ObjectMapper { public ; protected ; } -keep class com.fasterxml.jackson.databind.ObjectWriter { public ** writeValueAsString(**); } -keepnames class com.fasterxml.jackson.** { *; } -dontwarn com.fasterxml.jackson.databind.** -dontwarn okhttp3.** -dontwarn okio.** -dontwarn retrofit2.Platform$Java8` but after this all error solved but application is not able to called any functions –  Jul 17 '17 at 05:36
0

Add these lines in proguard-rules file:

-dontwarn okhttp3.**
-dontwarn okio.**
-dontwarn com.fasterxml.jackson.databind.**

Reference

Vishal Yadav
  • 3,642
  • 3
  • 25
  • 42
  • i have defined : `-keep class com.fasterxml.jackson.databind.ObjectMapper { public ; protected ; } -keep class com.fasterxml.jackson.databind.ObjectWriter { public ** writeValueAsString(**); } -keepnames class com.fasterxml.jackson.** { *; } -dontwarn com.fasterxml.jackson.databind.** -dontwarn okhttp3.** -dontwarn okio.** -dontwarn retrofit2.Platform$Java8` but after this all error solved but application is not able to called any functions. –  Jul 17 '17 at 05:36