Android proguard errors

I am trying to create my apk and enable the following flags in release build type

  • minifyEnabled true
  • shrinkResources true

When creating apk for release, I get the following warnings from proguard, and as a result, my build does not work (see below).

I tried to suppress the warning by adding the following to my pro pro pro pro pro

-dontwarn android.test. ** -dontwarn com.amazonaws. ** -dontwarn com.android.volley. ** -dontwarn com.fasterxml.jackson. ** -dontwarn com.viewpagerindicator. ** -dontwarn okio. ** -dontwarn org.joda.time. ** -dontwarn se.walkercrou. ** -dontwarn org.codehaus.mojo. **

After that, I was able to generate the APK, but when I try to run the APK on my mobile device, it crashed into Launch.

Then I even researched what we can add

-libraryjars '/to/jar/file.jar' , jar (s), , Gradle.

:

:app:proguardRelease
Note: there were 12 duplicate class definitions.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
Warning: library class android.test.AndroidTestCase extends or implements program class junit.framework.TestCase
Warning: library class android.test.AndroidTestRunner extends or implements program class junit.runner.BaseTestRunner
Warning: library class android.test.InstrumentationTestCase extends or implements program class junit.framework.TestCase
Warning: library class android.test.InstrumentationTestSuite extends or implements program class junit.framework.TestSuite
Warning: library class android.test.suitebuilder.TestSuiteBuilder$FailedToCreateTests extends or implements program class junit.framework.TestCase
Warning: com.amazonaws.http.HttpClientFactory: can't find referenced method 'void setHttpRequestRetryHandler(org.apache.http.client.HttpRequestRetryHandler)' in program class com.amazonaws.http.impl.client.SdkHttpClient
Warning: com.amazonaws.http.HttpClientFactory: can't find referenced method 'void setRedirectHandler(org.apache.http.client.RedirectHandler)' in program class com.amazonaws.http.impl.client.SdkHttpClient
Warning: com.amazonaws.http.HttpClientFactory: can't find referenced method 'org.apache.http.conn.ClientConnectionManager getConnectionManager()' in program class com.amazonaws.http.impl.client.SdkHttpClient
Warning: com.amazonaws.http.HttpClientFactory: can't find referenced method 'org.apache.http.params.HttpParams getParams()' in program class com.amazonaws.http.impl.client.SdkHttpClient
Warning: com.amazonaws.http.HttpClientFactory: can't find referenced method 'org.apache.http.client.CredentialsProvider getCredentialsProvider()' in program class com.amazonaws.http.impl.client.SdkHttpClient
Warning: com.amazonaws.http.RepeatableInputStreamRequestEntity: can't find referenced method 'void setChunked(boolean)' in program class com.amazonaws.http.RepeatableInputStreamRequestEntity
Warning: com.amazonaws.http.RepeatableInputStreamRequestEntity: can't find referenced method 'void setContent(java.io.InputStream)' in program class com.amazonaws.http.RepeatableInputStreamRequestEntity
Warning: com.amazonaws.http.RepeatableInputStreamRequestEntity: can't find referenced method 'void setContentType(java.lang.String)' in program class com.amazonaws.http.RepeatableInputStreamRequestEntity
Warning: com.amazonaws.http.RepeatableInputStreamRequestEntity: can't find referenced method 'void setContentLength(long)' in program class com.amazonaws.http.RepeatableInputStreamRequestEntity
Warning: com.amazonaws.metrics.MetricInputStreamEntity: can't find referenced method 'java.io.InputStream getContent()' in program class com.amazonaws.metrics.MetricInputStreamEntity
Warning: com.amazonaws.metrics.MetricInputStreamEntity: can't find referenced method 'long getContentLength()' in program class com.amazonaws.metrics.MetricInputStreamEntity
Warning: com.android.volley.toolbox.HttpClientStack: can't find referenced method 'void addHeader(java.lang.String,java.lang.String)' in program class com.android.volley.toolbox.HttpClientStack$HttpPatch
Warning: com.android.volley.toolbox.HttpClientStack$HttpPatch: can't find referenced method 'void setURI(java.net.URI)' in program class com.android.volley.toolbox.HttpClientStack$HttpPatch
Warning: com.android.volley.toolbox.Volley: can't find referenced class android.net.http.AndroidHttpClient
Warning: com.android.volley.toolbox.Volley: can't find referenced class android.net.http.AndroidHttpClient
Warning: com.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry
Warning: com.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry
Warning: com.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry
Warning: com.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry
Warning: com.viewpagerindicator.LinePageIndicator: can't find referenced method 'float ceil(float)' in library class android.util.FloatMath
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.Files
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: org.joda.time.DateMidnight: can't find referenced class org.joda.convert.FromString
Warning: org.joda.time.DateTime: can't find referenced class org.joda.convert.FromString
Warning: org.joda.time.DateTimeZone: can't find referenced class org.joda.convert.FromString
Warning: org.joda.time.DateTimeZone: can't find referenced class org.joda.convert.ToString
Warning: org.joda.time.Days: can't find referenced class org.joda.convert.FromString
Warning: org.joda.time.Days: can't find referenced class org.joda.convert.ToString
Warning: org.joda.time.Duration: can't find referenced class org.joda.convert.FromString
Warning: org.joda.time.Hours: can't find referenced class org.joda.convert.FromString
Warning: org.joda.time.Hours: can't find referenced class org.joda.convert.ToString
Warning: org.joda.time.Instant: can't find referenced class org.joda.convert.FromString
Warning: org.joda.time.LocalDate: can't find referenced class org.joda.convert.FromString
Warning: org.joda.time.LocalDate: can't find referenced class org.joda.convert.ToString
Warning: org.joda.time.LocalDateTime: can't find referenced class org.joda.convert.FromString
Warning: org.joda.time.LocalDateTime: can't find referenced class org.joda.convert.ToString
Warning: org.joda.time.LocalTime: can't find referenced class org.joda.convert.FromString
Warning: org.joda.time.LocalTime: can't find referenced class org.joda.convert.ToString
Warning: org.joda.time.Minutes: can't find referenced class org.joda.convert.FromString
Warning: org.joda.time.Minutes: can't find referenced class org.joda.convert.ToString
Warning: org.joda.time.MonthDay: can't find referenced class org.joda.convert.FromString
Warning: org.joda.time.MonthDay: can't find referenced class org.joda.convert.ToString
Warning: org.joda.time.Months: can't find referenced class org.joda.convert.FromString
Warning: org.joda.time.Months: can't find referenced class org.joda.convert.ToString
Warning: org.joda.time.MutableDateTime: can't find referenced class org.joda.convert.FromString
Warning: org.joda.time.MutablePeriod: can't find referenced class org.joda.convert.FromString
Warning: org.joda.time.Period: can't find referenced class org.joda.convert.FromString
Warning: org.joda.time.Seconds: can't find referenced class org.joda.convert.FromString
Warning: org.joda.time.Seconds: can't find referenced class org.joda.convert.ToString
Warning: org.joda.time.Weeks: can't find referenced class org.joda.convert.FromString
Warning: org.joda.time.Weeks: can't find referenced class org.joda.convert.ToString
Warning: org.joda.time.YearMonth: can't find referenced class org.joda.convert.FromString
Warning: org.joda.time.YearMonth: can't find referenced class org.joda.convert.ToString
Warning: org.joda.time.Years: can't find referenced class org.joda.convert.FromString
Warning: org.joda.time.Years: can't find referenced class org.joda.convert.ToString
Warning: org.joda.time.base.AbstractDateTime: can't find referenced class org.joda.convert.ToString
Warning: org.joda.time.base.AbstractDuration: can't find referenced class org.joda.convert.ToString
Warning: org.joda.time.base.AbstractInstant: can't find referenced class org.joda.convert.ToString
Warning: org.joda.time.base.AbstractPeriod: can't find referenced class org.joda.convert.ToString
Warning: se.walkercrou.places.Photo: can't find referenced class javax.imageio.ImageIO
Warning: se.walkercrou.places.Photo: can't find referenced class javax.imageio.ImageIO
Warning: se.walkercrou.places.Photo: can't find referenced class java.awt.image.BufferedImage
Warning: se.walkercrou.places.Place: can't find referenced class javax.imageio.ImageIO
Warning: se.walkercrou.places.Place: can't find referenced class javax.imageio.ImageIO
Warning: se.walkercrou.places.Place: can't find referenced class java.awt.image.BufferedImage
Warning: there were 63 unresolved references to classes or interfaces.
         You may need to add missing library jars or update their versions.
         If your code works fine without the missing classes, you can suppress
         the warnings with '-dontwarn' options.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning: there were 5 instances of library classes depending on program classes.
         You must avoid such dependencies, since the program classes will
         be processed, while the library classes will remain unchanged.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#dependency)
Warning: there were 13 unresolved references to program class members.
         Your input classes appear to be inconsistent.
         You may need to recompile the code.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
Warning: there were 1 unresolved references to library class members.
         You probably need to update the library versions.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
:app:proguardRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:proguardRelease'.
> java.io.IOException: Please correct the above warnings first.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED
+4

Source: https://habr.com/ru/post/1629452/


All Articles