0
votes

I want to reduce size of .apk file, so I am checking Enable ProGuard option in Android project's property window but getting compile time errors

Error "java.exe" exited with code 1.

I tried few things like

  • Head size is already 1G.
  • Android target version is 9.0(Pie).
  • My Solutions Configuration in Release mode.

Log:

8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax$a: can't find superclass or interface org.apache.http.client.ResponseHandler
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.Instrumentation: can't find referenced class com.appdynamics.eumagent.runtime.BuildInfo
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.Instrumentation: can't find referenced class com.appdynamics.eumagent.runtime.BuildInfo
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.methods.HttpUriRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.HttpResponse
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.methods.HttpUriRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.protocol.HttpContext
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.HttpResponse
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.HttpHost
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.HttpRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.HttpResponse
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.HttpHost
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.HttpRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.protocol.HttpContext
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.HttpResponse
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.methods.HttpUriRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.ResponseHandler
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.methods.HttpUriRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.ResponseHandler
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.protocol.HttpContext
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.HttpHost
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.HttpRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.ResponseHandler
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.HttpHost
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.HttpRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.client.ResponseHandler
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.InstrumentationCallbacks: can't find referenced class org.apache.http.protocol.HttpContext
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.Header
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpEntity
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpEntityEnclosingRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpHost
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpResponse
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.RequestLine
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.StatusLine
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.methods.HttpUriRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpHost
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.Header
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.Header
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpEntity
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpEntityEnclosingRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpResponse
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpResponse
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpResponse
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.RequestLine
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.StatusLine
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.StatusLine
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.methods.HttpUriRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.methods.HttpUriRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpHost
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.methods.HttpUriRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpHost
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpEntity
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpResponse
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.methods.HttpUriRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpResponse
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.methods.HttpUriRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.protocol.HttpContext
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpResponse
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpHost
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpResponse
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpHost
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.protocol.HttpContext
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpResponse
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.methods.HttpUriRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.ResponseHandler
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.methods.HttpUriRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.ResponseHandler
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.protocol.HttpContext
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpHost
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.ResponseHandler
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.HttpClient
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpHost
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.HttpRequest
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.client.ResponseHandler
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax: can't find referenced class org.apache.http.protocol.HttpContext
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax$a: can't find referenced class org.apache.http.client.ResponseHandler
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax$a: can't find referenced class org.apache.http.client.ResponseHandler
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax$a: can't find referenced class org.apache.http.HttpResponse
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax$a: can't find referenced class org.apache.http.client.ResponseHandler
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax$a: can't find referenced class org.apache.http.client.ResponseHandler
8>PROGUARD : warning : com.appdynamics.eumagent.runtime.private.ax$a: can't find referenced class org.apache.http.HttpResponse
8>PROGUARD : warning : there were 123 unresolved references to classes or interfaces.
8>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2550,3): error MSB6006: "java.exe" exited with code 1.
========== Build: 7 succeeded, 1 failed, 4 up-to-date, 0 skipped ==========

I am using proguard 4.7 file. I can't use latest proguard file as I am not allowed to download any external files. How can I fix this issue?

1
Please add the log here and not as some off-site resource - Cheesebaron
@Cheesebaron - I tried that but log (From VS output window) is too long which going to look weird here. Moreover, SO editor not accepting that. Thank you. - R15
Narrow it down to where it fails - Cheesebaron
@Cheesebaron - I have added log in question as short as needed for SO editor. Thank you. - R15
org.apache.http is legacy in Google Play services. Which version of Play Services are you referencing? If it is the newest, you might be hitting a bug in the Xamarin bindings. - Cheesebaron

1 Answers

0
votes

After a long research I have found solutions for this issue.

First download latest Proguard file from here unzip and copy to sdk path C:\Program Files (x86)\Android\android-sdk\tools, this path could be different in your case.

There must be already one proguard folder, rename that to proguard.old. Now from proguard.old folder copy and paste proguard-android, proguard-android-optimize, proguard-project files to newly created proguard folder.

After that need to follow below steps

  • Create txt file somewhere in your PC and change extension to .cfg.
  • Change proguard.cfg file Encoding using Notepad++ to UTF-8 without BOM and Save As somewhere.
  • Now add this new proguard.cfg to your android project level.
  • Change proguard.cfg file build action to ProguardConfiguration
  • Clean your project.

If you are getting warnings with prefix progurd like this

PROGUARD : warning : com.appdynamics.eumagent.runtime.private

Now you need to add this package to your custom proguard.cfg file like

-dontwarn com.appdynamics.eumagent.runtime.**

With -dontwarn do not use keyword class. Here ** takes all child classes of given package.

If you are getting exception then you need to find out which library causing issue and add that in proguard.cfg file with -keep keyword

-keep public class android.support.v7.widget.** { *; } 

If you see your full log carefully progaurd gives all warnings to make us easy to find out issue.