I use Azure mobile app in my new Android project.
When I run the app on debug mode, the Mobile app works successfully and I can see my new records in my table.
My problem is starting when I creates an apk file with proguard.
I am sorry to say that I am newbie on Proguard then I can not solve my Proguard problems even I read the documentation at offical Proguard page.
So, I get these errors when I try to create apk file with Proguard without any Proguard code.
Warning: com.google.common.base.Absent: can't find referenced class javax.annotation.Nullable
Warning: com.google.common.base.Absent: can't find referenced class javax.annotation.Nullable
Warning: com.google.common.base.Ascii: can't find referenced class javax.annotation.CheckReturnValue
Warning: com.google.common.base.CaseFormat$StringConverter: can't find referenced class javax.annotation.Nullable
Warning: com.google.common.base.CharMatcher: can't find referenced class javax.annotation.CheckReturnValue
Warning: com.google.common.base.CharMatcher: can't find referenced class javax.annotation.CheckReturnValue
Warning: com.google.common.base.CharMatcher: can't find referenced class javax.annotation.CheckReturnValue
and more hundreads line...
Warning: com.google.common.cache.Striped64: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.cache.Striped64: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.cache.Striped64: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.cache.Striped64: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.cache.Striped64$1: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.cache.Striped64$1: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.cache.Striped64$1: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.cache.Striped64$1: can't find referenced class sun.misc.Unsafe
and more hundreads line....
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
Then I added these line in my proguard.
-keep class okio.** { *; }
-dontwarn okio.**
-keep class com.fasterxml.** { *; }
-dontwarn com.fasterxml.**
-dontwarn javax.annotation.**
-dontwarn javax.inject.**
-dontwarn sun.misc.Unsafe
-keep class com.microsoft.windowsazure.mobileservices.** { *; }
-dontwarn android.os.**
-dontwarn com.microsoft.windowsazure.mobileservices.RequestAsyncTask
After that, Android studio created the apk however The app crahsed as soon as It started. Then I investigate the logs, I saw new warnings that color are white.
Note: duplicate definition of library class [org.apache.http.conn.scheme.LayeredSocketFactory]
Note: duplicate definition of library class [org.apache.http.conn.scheme.SocketFactory]
Note: duplicate definition of library class [org.apache.http.conn.scheme.HostNameResolver]
Note: duplicate definition of library class [org.apache.http.conn.ConnectTimeoutException]
Note: duplicate definition of library class [org.apache.http.params.CoreConnectionPNames]
Note: duplicate definition of library class [org.apache.http.params.HttpParams]
Note: duplicate definition of library class [org.apache.http.params.HttpConnectionParams]
Note: duplicate definition of library class [android.net.http.SslError]
Note: duplicate definition of library class [android.net.http.HttpResponseCache]
Note: duplicate definition of library class [android.net.http.SslCertificate$DName]
Note: duplicate definition of library class [android.net.http.SslCertificate]
Note: there were 11 duplicate class definitions.
(http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
Thanks for help.
#MustafaOlkun, It seems that the solutions for your issues can be found at the troubleshooting page of ProGuard.
For the issue Warning: can't find referenced class, please see http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass.
For the issue Note: duplicate definition of library class, please see http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass.
Hope it helps.
Related
Now the only problem stopping me from using kotlin in production is that I can't find a correct proguard file for it.
What I used:
1.Kotlin
2.Anko
3.Jackson-Kotlin-module
Here's the warning message:
:app:proguardRelease
Warning: com.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry
Warning: rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef: can't find referenced class sun.misc.Unsafe
Warning: rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef: can't find referenced class sun.misc.Unsafe
Warning: rx.internal.util.unsafe.ConcurrentCircularArrayQueue: can't find referenced class sun.misc.Unsafe
Warning: rx.internal.util.unsafe.ConcurrentSequencedCircularArrayQueue: can't find referenced class sun.misc.Unsafe
Warning: rx.internal.util.unsafe.MpmcArrayQueueConsumerField: can't find referenced class sun.misc.Unsafe
Warning: rx.internal.util.unsafe.MpmcArrayQueueProducerField: can't find referenced class sun.misc.Unsafe
Warning: rx.internal.util.unsafe.MpscLinkedQueue: can't find referenced class sun.misc.Unsafe
Warning: rx.internal.util.unsafe.SpmcArrayQueueConsumerField: can't find referenced class sun.misc.Unsafe
Warning: rx.internal.util.unsafe.SpmcArrayQueueProducerField: can't find referenced class sun.misc.Unsafe
Warning: rx.internal.util.unsafe.SpscArrayQueue: can't find referenced class sun.misc.Unsafe
Warning: rx.internal.util.unsafe.UnsafeAccess: can't find referenced class sun.misc.Unsafe
Warning: there were 41 unresolved references to classes or interfaces.
It has nothing to do with Kotlin. Ignore the warnings in your proguard file:
-dontwarn sun.misc.Unsafe
-dontwarn org.w3c.dom.bootstrap.DOMImplementationRegistry
a better is just to have this aar as a dependency:
https://github.com/artem-zinnatullin/RxJavaProGuardRules
when I tried to compile to release using ./gradlew assembleRelease
, I got these error. I didn't signed it yet, but according to http://developer.android.com/tools/building/building-cmdline.html, I can signed it later.
Warning: com.flurry.sdk.hn: can't find referenced class com.google.android.gms.ads.identifier.AdvertisingIdClient
Warning: com.flurry.sdk.hn: can't find referenced class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info
Warning: com.flurry.sdk.hn: can't find referenced class com.google.android.gms.ads.identifier.AdvertisingIdClient
Warning: com.flurry.sdk.hn: can't find referenced class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info
Warning: com.flurry.sdk.hn: can't find referenced class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info
Warning: com.flurry.sdk.hn: can't find referenced class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info
Warning: com.flurry.sdk.hn: can't find referenced class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info
Warning: com.flurry.sdk.kg: can't find referenced class com.flurry.sdk.i
from Flurry integrations with Android App gives an error "Could not find class 'com.flurry.sdk.i', referenced from method com.flurry.sdk.hu.a", if you don't care about FlurryAds, you can ignore it.
in your app/proguard-rules.pro, insert these lines
-dontwarn com.google.android.gms.ads.identifier.AdvertisingIdClient**
-dontwarn com.flurry.sdk.i
I need to generate a signed APK for Play Store. ( using Android Studio )
If I do that without proguard ( minifyEnabled false in build.gradle ) all works fine!
If I activate it with default parameters :
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
I receive these warnings
:app:proguardRelease
Warning: com.android.volley.error.VolleyErrorHelper$1: can't find superclass or interface com.google.gson.reflect.TypeToken
Warning: com.android.volley.error.VolleyErrorHelper: can't find referenced class com.google.gson.Gson
Warning: com.android.volley.error.VolleyErrorHelper: can't find referenced class com.google.gson.Gson
Warning: com.android.volley.error.VolleyErrorHelper: can't find referenced method 'java.lang.reflect.Type getType()' in program class com.android.volley.error.VolleyErrorHelper$1
Warning: com.android.volley.error.VolleyErrorHelper: can't find referenced class com.google.gson.Gson
Warning: com.android.volley.error.VolleyErrorHelper$1: can't find referenced class com.google.gson.reflect.TypeToken
Warning: com.android.volley.error.VolleyErrorHelper$1: can't find referenced class com.google.gson.reflect.TypeToken
Warning: com.android.volley.error.VolleyErrorHelper$1: can't find referenced class com.google.gson.reflect.TypeToken
Warning: com.android.volley.request.GsonRequest: can't find referenced class com.google.gson.Gson
Warning: com.android.volley.request.GsonRequest: can't find referenced class com.google.gson.Gson
Warning: com.android.volley.request.GsonRequest: can't find referenced class com.google.gson.Gson
Warning: com.android.volley.request.GsonRequest: can't find referenced class com.google.gson.JsonSyntaxException
Warning: com.android.volley.request.GsonRequest: can't find referenced class com.google.gson.JsonSyntaxException
Warning: com.android.volley.request.GsonRequest: can't find referenced class com.google.gson.Gson
Warning: com.android.volley.request.GsonRequest: can't find referenced class com.google.gson.JsonSyntaxException
Warning: com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl: can't find referenced method 'long getContentLengthLong()' in program class com.squareup.okhttp.internal.huc.HttpURLConnectionImpl
Warning: com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl: can't find referenced method 'long getHeaderFieldLong(java.lang.String,long)' in program class com.squareup.okhttp.internal.huc.HttpURLConnectionImpl
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: there were 28 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 3 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)
Exception while processing task
java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:473)
at proguard.ProGuard.initialize(ProGuard.java:233)
at proguard.ProGuard.execute(ProGuard.java:98)
at proguard.gradle.ProGuardTask.proguard(ProGuardTask.java:1074)
at com.android.build.gradle.tasks.AndroidProGuardTask.doMinification(AndroidProGuardTask.java:137)
at com.android.build.gradle.tasks.AndroidProGuardTask$1.run(AndroidProGuardTask.java:113)
at com.android.builder.tasks.Job.runTask(Job.java:48)
at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:227)
at java.lang.Thread.run(Thread.java:745)
:app:dexRelease UP-TO-DATE
:app:validateExternalOverrideSigning
:app:packageRelease
And the build process stop with this message :
Error:Execution failed for task ':app:packageRelease'.
> Unable to compute hash of ...\app\build\intermediates\classes-proguard\release\classes.jar
After several tentatives I've found a way to remove the warnings with this lines in my "proguard-rules.pro" :
-dontwarn com.android.volley.**
-dontwarn com.squareup.okhttp.**
-dontwarn okio.**
But the build process still goes in error!
Anyone have a workaround for this problem?
Thanks!
Davide
After several attemps ... here the solution :
First configure the dontwarn as suggested by Raymond ( maybe this is not necessary but i left it ) :
-dontwarn com.google.gson.**
-dontwarn java.nio.file.**
-dontwarn org.codehaus.mojo.animal_sniffer.**
-dontwarn com.squareup.okhttp.internal.huc.**
-dontwarn com.android.volley.error.**
Then configure Proguard to skip my library :
-keep class com.android.volley.error.** { *; }
-keep class com.squareup.okhttp.internal.huc.** { *; }
-keep class okio.** { *; }
Ather that the compilation was ok but on runtime the application crashed.
So, to avoid this problem, i've added these lines :
-keep class android.support.design.widget.** { *; }
-keep interface android.support.design.widget.** { *; }
-dontwarn android.support.design.**
based on some info found from this thread :
java.lang.RuntimeException: Could not inflate Behavior subclass
With this settings i'm able to generate a signed APK of my app.
You have to apply dontwarn to the referenced class instead.
For example:
-dontwarn com.google.gson.**
-dontwarn java.nio.file.**
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.
The error is not of parse sdk, it occures because of okHttp. Add below lines in your proguard.
-keepattributes *Annotation*
-keepattributes Signature
-dontwarn com.squareup.**
-keep class com.squareup.** { *; }
Edit
for com.fasterxml.jackson add below code :
-keep class com.fasterxml.jackson.databind.ObjectMapper {
public <methods>;
protected <methods>;
}
-keep class com.fasterxml.jackson.databind.ObjectWriter {
public ** writeValueAsString(**);
}
reference : https://github.com/krschultz/android-proguard-snippets/issues/19
I'm using proguard for the first time, and when I compiled the app I received the following error stack:
Note: there were 1 duplicate class definitions.
(http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
Warning:org.codehaus.jackson.map.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry
Warning:org.codehaus.jackson.map.ext.JodaDeserializers: can't find referenced class org.joda.time.DateTime
Warning:org.codehaus.jackson.map.ext.JodaDeserializers: can't find referenced class org.joda.time.ReadableDateTime
Warning:org.codehaus.jackson.map.ext.JodaDeserializers: can't find referenced class org.joda.time.ReadableInstant
Warning:org.codehaus.jackson.map.ext.JodaDeserializers$DateMidnightDeserializer: can't find referenced class org.joda.time.DateMidnight
Warning:org.codehaus.jackson.map.ext.JodaDeserializers$DateMidnightDeserializer: can't find referenced class org.joda.time.DateTime
Warning:org.codehaus.jackson.map.ext.JodaDeserializers$DateMidnightDeserializer: can't find referenced class org.joda.time.DateMidnight
Warning:org.codehaus.jackson.map.ext.JodaDeserializers$DateMidnightDeserializer: can't find referenced class org.joda.time.DateTime
Warning:org.codehaus.jackson.map.ext.JodaDeserializers$DateMidnightDeserializer: can't find referenced class org.joda.time.DateMidnight
Warning:org.codehaus.jackson.map.ext.JodaDeserializers$DateTimeDeserializer: can't find referenced class org.joda.time.DateTime
Warning:org.codehaus.jackson.map.ext.JodaDeserializers$DateTimeDeserializer: can't find referenced class org.joda.time.DateTimeZone
Warning:org.codehaus.jackson.map.ext.JodaDeserializers$DateTimeDeserializer: can't find referenced class org.joda.time.DateTime
Warning:org.codehaus.jackson.map.ext.JodaDeserializers$DateTimeDeserializer: can't find referenced class org.joda.time.ReadableInstant
Warning:org.codehaus.jackson.map.ext.JodaDeserializers$JodaDeserializer: can't find referenced class org.joda.time.format.DateTimeFormatter
Warning:org.codehaus.jackson.map.ext.JodaDeserializers$JodaDeserializer: can't find referenced class org.joda.time.format.ISODateTimeFormat
Warning:org.codehaus.jackson.map.ext.JodaDeserializers$JodaDeserializer: can't find referenced class org.joda.time.format.DateTimeFormatter
Warning:org.codehaus.jackson.map.ext.JodaDeserializers$JodaDeserializer: can't find referenced class org.joda.time.DateTime
Warning:org.codehaus.jackson.map.ext.JodaDeserializers$LocalDateDeserializer: can't find referenced class org.joda.time.LocalDate
Warning:org.codehaus.jackson.map.ext.JodaDeserializers$LocalDateDeserializer: can't find referenced class org.joda.time.DateTime
Warning:org.codehaus.jackson.map.ext.JodaDeserializers$LocalDateDeserializer: can't find referenced class org.joda.time.LocalDate
Warning:org.codehaus.jackson.map.ext.JodaDeserializers$LocalDateDeserializer: can't find referenced class org.joda.time.DateTime
Warning:org.codehaus.jackson.map.ext.JodaDeserializers$LocalDateDeserializer: can't find referenced class org.joda.time.LocalDate
Warning:org.codehaus.jackson.map.ext.JodaDeserializers$LocalDateTimeDeserializer: can't find referenced class org.joda.time.LocalDateTime
Warning:org.codehaus.jackson.map.ext.JodaDeserializers$LocalDateTimeDeserializer: can't find referenced class org.joda.time.DateTime
Warning:org.codehaus.jackson.map.ext.JodaDeserializers$LocalDateTimeDeserializer: can't find referenced class org.joda.time.LocalDateTime
Warning:org.codehaus.jackson.map.ext.JodaDeserializers$LocalDateTimeDeserializer: can't find referenced class org.joda.time.DateTime
Warning:org.codehaus.jackson.map.ext.JodaDeserializers$LocalDateTimeDeserializer: can't find referenced class org.joda.time.LocalDateTime
Warning:org.codehaus.jackson.map.ext.JodaSerializers: can't find referenced class org.joda.time.DateTime
Warning:org.codehaus.jackson.map.ext.JodaSerializers: can't find referenced class org.joda.time.LocalDateTime
Warning:org.codehaus.jackson.map.ext.JodaSerializers: can't find referenced class org.joda.time.LocalDate
Warning:org.codehaus.jackson.map.ext.JodaSerializers: can't find referenced class org.joda.time.DateMidnight
Warning:org.codehaus.jackson.map.ext.JodaSerializers$DateMidnightSerializer: can't find referenced class org.joda.time.DateMidnight$Property
Warning:org.codehaus.jackson.map.ext.JodaSerializers$DateMidnightSerializer: can't find referenced class org.joda.time.DateMidnight
Warning:org.codehaus.jackson.map.ext.JodaSerializers$DateMidnightSerializer: can't find referenced class org.joda.time.DateMidnight$Property
Warning:org.codehaus.jackson.map.ext.JodaSerializers$DateMidnightSerializer: can't find referenced class org.joda.time.DateMidnight
Warning:org.codehaus.jackson.map.ext.JodaSerializers$DateTimeSerializer: can't find referenced class org.joda.time.DateTime
Warning:org.codehaus.jackson.map.ext.JodaSerializers$JodaSerializer: can't find referenced class org.joda.time.format.DateTimeFormatter
Warning:org.codehaus.jackson.map.ext.JodaSerializers$JodaSerializer: can't find referenced class org.joda.time.format.ISODateTimeFormat
Warning:org.codehaus.jackson.map.ext.JodaSerializers$JodaSerializer: can't find referenced class org.joda.time.format.DateTimeFormatter
Warning:org.codehaus.jackson.map.ext.JodaSerializers$JodaSerializer: can't find referenced class org.joda.time.ReadablePartial
Warning:org.codehaus.jackson.map.ext.JodaSerializers$JodaSerializer: can't find referenced class org.joda.time.ReadableInstant
Warning:org.codehaus.jackson.map.ext.JodaSerializers$LocalDateSerializer: can't find referenced class org.joda.time.LocalDate$Property
Warning:org.codehaus.jackson.map.ext.JodaSerializers$LocalDateSerializer: can't find referenced class org.joda.time.LocalDate
Warning:org.codehaus.jackson.map.ext.JodaSerializers$LocalDateSerializer: can't find referenced class org.joda.time.LocalDate$Property
Warning:org.codehaus.jackson.map.ext.JodaSerializers$LocalDateSerializer: can't find referenced class org.joda.time.LocalDate
Warning:org.codehaus.jackson.map.ext.JodaSerializers$LocalDateTimeSerializer: can't find referenced class org.joda.time.LocalDateTime$Property
Warning:org.codehaus.jackson.map.ext.JodaSerializers$LocalDateTimeSerializer: can't find referenced class org.joda.time.LocalDateTime
Warning:org.codehaus.jackson.map.ext.JodaSerializers$LocalDateTimeSerializer: can't find referenced class org.joda.time.LocalDateTime$Property
Warning:org.codehaus.jackson.map.ext.JodaSerializers$LocalDateTimeSerializer: can't find referenced class org.joda.time.LocalDateTime
Warning:there were 99 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)
:app:proguardDebug FAILED
I tried with both the basic changes to proguard-rules.txt and with everything in that file commented out and get the same result, so the contents of that (or lack thereof) don't seem to have any bearing on this error being thrown.
As you can see, there isn't anything pointing to what exactly is duplicate. Also, the warning lines below the message about duplication reference a package I don't use anywhere in my app.
I've tried searching for this problem and attempted to add some lines such as
-keep class android.support.v4.** { *; }
which someone suggested but that didn't do the trick.
Here is something in the build.gradle file for my app which is raising a flag:
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
I have a file proguard-rules.txt in the root folder of my app (the same directory as my build.gradle file), but I don't have a proguard-android.txt file there, or anywhere else I could find for that matter. Could that be a cause?
Any ideas? Thanks!
You actually don't have any errors, these are warnings which, according to what the log says,
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
can be suppressed with the following line in the ProGuard config:
-dontwarn org.codehaus.jackson.map.ext.**
Add on your PROGuard file:
-dontwarn org.joda.convert.**
-dontwarn org.codehaus.jackson.map.ext.**
-keep class org.w3c.dom.bootstrap.** { *; }
-keep class org.joda.time.** { *; }
Try adding the following to your proguard config:
-keep class org.w3c.dom.bootstrap.** { *; }
-keep class org.joda.time.** { *; }