I am using Parse on a project. The project uses my own Android library project which has the Parse jars in it. When I try to generate a signed apk, gradle gives the following issue:
:exampleApp:proguardRelease Warning: com.parse.ParseOkHttpClient$CountingOkHttpRequestBody: can't find superclass or interface com.squareup.okhttp.RequestBody 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.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.OkHttpClient Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.OkHttpClient Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.OkHttpClient Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.OkHttpClient Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.OkHttpClient Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.OkHttpClient Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.OkHttpClient Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.OkHttpClient Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Call Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Response Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Response Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.ResponseBody Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.ResponseBody Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Response Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Request$Builder Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Request$Builder Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Request$Builder Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Request$Builder Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Request$Builder Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Headers$Builder Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Headers$Builder Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Headers$Builder Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Headers$Builder Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Request$Builder Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Request$Builder Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Request$Builder Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Request$Builder Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Response Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Request$Builder Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Headers$Builder Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Headers Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Call Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.ResponseBody Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Request Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Headers Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.OkHttpClient Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Request Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Call Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Response Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Call Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Call Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Response Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Response Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Request Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Request$Builder Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Headers$Builder Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Headers Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Request Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Response Warning: com.parse.ParseOkHttpClient$1: can't find referenced class com.squareup.okhttp.Call Warning: com.parse.ParseOkHttpClient$1: can't find referenced class com.squareup.okhttp.Call Warning: com.parse.ParseOkHttpClient$1: can't find referenced class com.squareup.okhttp.Call Warning: com.parse.ParseOkHttpClient$1: can't find referenced class com.squareup.okhttp.Call Warning: com.parse.ParseOkHttpClient$CountingOkHttpRequestBody: can't find referenced class com.squareup.okhttp.RequestBody Warning: com.parse.ParseOkHttpClient$CountingOkHttpRequestBody: can't find referenced class com.squareup.okhttp.MediaType Warning: com.parse.ParseOkHttpClient$CountingOkHttpRequestBody: can't find referenced class okio.BufferedSink Warning: com.parse.ParseOkHttpClient$CountingOkHttpRequestBody: can't find referenced class com.squareup.okhttp.RequestBody Warning: com.parse.ParseOkHttpClient$CountingOkHttpRequestBody: can't find referenced class com.squareup.okhttp.MediaType Warning: com.parse.ParseOkHttpClient$CountingOkHttpRequestBody: can't find referenced class okio.BufferedSink Warning: com.parse.ParseOkHttpClient$CountingOkHttpRequestBody: can't find referenced class com.squareup.okhttp.MediaType Warning: com.parse.ParseOkHttpClient$CountingOkHttpRequestBody: can't find referenced class okio.BufferedSink Warning: com.parse.ParseOkHttpClient$CountingOkHttpRequestBody: can't find referenced class okio.BufferedSink Warning: there were 67 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) :exampleApp:proguardRelease FAILED
FAILURE: Build failed with an exception.
Edit: Per @karama's suggestion, I added this to my proguard rules:
-keepattributes *Annotation*
-keepattributes Signature
-dontwarn com.squareup.**
-keep class com.squareup.** { *; }
-dontwarn com.parse.ParseOkHttpClient**
-keep class com.parse.ParseOkHttpClient** { *; }
# Proguard configuration for Jackson 2.x (fasterxml package instead of codehaus package)
-keep class com.fasterxml.jackson.databind.ObjectMapper {
public <methods>;
protected <methods>;
}
-keep class com.fasterxml.jackson.databind.ObjectWriter {
public ** writeValueAsString(**);
}
-dontwarn org.w3c.dom.bootstrap.DOMImplementationRegistry
Yet, now I get the following:
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.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry Warning: there were 5 unresolved references to classes or interfaces.
If I fix it with adding: -dontwarn org.w3c.dom.bootstrap.DOMImplementationRegistry When the app runs, it crashes. I saw this issue here but with no resolution: https://stackoverflow.com/a/11249755/197127
Running the app with -dontobfuscate works fine.