0

When I build apk I get the warning, as shown in the image.Problem occurs when shrinking and minify option along with Proguard is enabled. Apk builds without problem when everything above is turned off. Can anyone help me to fix this error?. I tried adding autovalue dependency by searching on Stackoverflow. But still the problem persists.

Any Solution? enter image description here

https://i.stack.imgur.com/m0Vxe.png

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

Govind Narayan
  • 91
  • 1
  • 12
  • Try to use this solution: https://stackoverflow.com/a/38264829/9060113 – punchman Oct 26 '18 at 04:05
  • well at least show us the error. There's a red icon next to run tasks, but it collapsed. You did show us the warnings, but normally warnings don't break the build. – Joeri Hendrickx Oct 26 '18 at 06:12
  • @p.alexey I have tried that solution already and its not working.Hence asked. – Govind Narayan Oct 26 '18 at 06:33
  • @JoeriHendrickx I have updated the thread.Yes i know warning doesn't break the build.But i couldn't find out whats causing it.It is a simple app with a fragments.And without proguard and shrinking option the apk build was around 25 - 50 Mb so applied abi filters for just 'armeabi-v7a' and brought app down to 10 Mb.I still like to reduce its size and hence applied proguard .But i am stuck with this error for days. – Govind Narayan Oct 26 '18 at 06:38

2 Answers2

0

Try to add these rules into your proguard-rules.pro file:

-dontwarn javax.lang.**
-dontwarn javax.tools.**
-dontwarn javax.annotation.**
-dontwarn autovalue.shaded.com.**
-dontwarn com.google.auto.value.**
-dontwarn javax.servlet.**
-dontwarn sun.misc.**
-dontwarn autovalue.shaded.org.apache.commons.**
-dontwarn org.apache.log4j.**
-dontwarn org.apache.log.**
-dontwarn org.apache.velocity.**
-dontwarn org.apache.tools.**
-dontwarn org.jdom.**
-dontwarn org.java.lang.**

And proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' into your buildType with proguard in build.gradle file.

punchman
  • 1,350
  • 1
  • 13
  • 23
0

I found the Solution.

The Proguard file hasn't been linked properly. For those who come across this problem.

In Android studio go to file - Project Structure .On left side Modules - app- and from tab select Build Types and under Proguard file Link it from your source. Clean and Run.

Govind Narayan
  • 91
  • 1
  • 12