aminography / PrimeDatePicker

PrimeDatePicker is a tool that provides picking a single day, multiple days, and a range of days.
Apache License 2.0
472 stars 52 forks source link

Problem with ProGuard #13

Closed azaz5959 closed 4 years ago

azaz5959 commented 4 years ago

There is problem with this library when it comes to ProGuard. Library works just fine without ProGaurd enabled but otherwise it will crash. Here is the error log:

android.view.InflateException: Binary XML file line #178: Error inflating class com.aminography.primedatepicker.calendarview.PrimeCalendarView at android.view.LayoutInflater.createView(LayoutInflater.java:633) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743) at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) at android.view.LayoutInflater.inflate(LayoutInflater.java:504) at android.view.LayoutInflater.inflate(LayoutInflater.java:414) at android.view.LayoutInflater.inflate(LayoutInflater.java:365) at android.view.View.inflate(View.java:18532) at com.aminography.primedatepicker.fragment.BaseBottomSheetDialogFragment.setupDialog(SourceFile:26) at com.aminography.primedatepicker.fragment.PrimeDatePickerBottomSheet.setupDialog(SourceFile:30) at androidx.fragment.app.c.onGetLayoutInflater(SourceFile:387) at androidx.fragment.app.Fragment.performGetLayoutInflater(SourceFile:1478) at androidx.fragment.app.l.a(SourceFile:1361) at androidx.fragment.app.l.j(SourceFile:1668) at androidx.fragment.app.l.i(SourceFile:1748) at androidx.fragment.app.l.a(SourceFile:1812) at androidx.fragment.app.a.g(SourceFile:446) at androidx.fragment.app.l.a(SourceFile:2598) at androidx.fragment.app.l.b(SourceFile:2386) at androidx.fragment.app.l.c(SourceFile:2341) at androidx.fragment.app.l.c(SourceFile:2244) at androidx.fragment.app.l$c.run(SourceFile:422) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:288) at android.view.LayoutInflater.createView(LayoutInflater.java:607) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)  at android.view.LayoutInflater.inflate(LayoutInflater.java:504)  at android.view.LayoutInflater.inflate(LayoutInflater.java:414)  at android.view.LayoutInflater.inflate(LayoutInflater.java:365)  at android.view.View.inflate(View.java:18532)  at com.aminography.primedatepicker.fragment.BaseBottomSheetDialogFragment.setupDialog(SourceFile:26)  at com.aminography.primedatepicker.fragment.PrimeDatePickerBottomSheet.setupDialog(SourceFile:30)  at androidx.fragment.app.c.onGetLayoutInflater(SourceFile:387)  at androidx.fragment.app.Fragment.performGetLayoutInflater(SourceFile:1478)  at androidx.fragment.app.l.a(SourceFile:1361)  at androidx.fragment.app.l.j(SourceFile:1668)  at androidx.fragment.app.l.i(SourceFile:1748)  at androidx.fragment.app.l.a(SourceFile:1812)  at androidx.fragment.app.a.g(SourceFile:446)  at androidx.fragment.app.l.a(SourceFile:2598)  at androidx.fragment.app.l.b(SourceFile:2386)  at androidx.fragment.app.l.c(SourceFile:2341)  at androidx.fragment.app.l.c(SourceFile:2244)  at androidx.fragment.app.l$c.run(SourceFile:422)  at android.os.Handler.handleCallback(Handler.java:739)  at android.os.Handler.dispatchMessage(Handler.java:95)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5254)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)  Caused by: java.lang.NoSuchFieldException: map at java.lang.Class.getDeclaredField(Class.java:890) at d.a.a.i.a.c(SourceFile:39) at d.a.a.a$b.a(SourceFile:384) at d.a.a.a$b.a(SourceFile:389) at com.aminography.primedatepicker.calendarview.PrimeCalendarView.<init>(SourceFile:514) at com.aminography.primedatepicker.calendarview.PrimeCalendarView.<init>(SourceFile:41) at com.aminography.primedatepicker.calendarview.PrimeCalendarView.<init>(SourceFile) at java.lang.reflect.Constructor.newInstance(Native Method)  at java.lang.reflect.Constructor.newInstance(Constructor.java:288)  at android.view.LayoutInflater.createView(LayoutInflater.java:607)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)  at android.view.LayoutInflater.inflate(LayoutInflater.java:504)  at android.view.LayoutInflater.inflate(LayoutInflater.java:414)  at android.view.LayoutInflater.inflate(LayoutInflater.java:365)  at android.view.View.inflate(View.java:18532)  at com.aminography.primedatepicker.fragment.BaseBottomSheetDialogFragment.setupDialog(SourceFile:26)  at com.aminography.primedatepicker.fragment.PrimeDatePickerBottomSheet.setupDialog(SourceFile:30)  at androidx.fragment.app.c.onGetLayoutInflater(SourceFile:387)  at androidx.fragment.app.Fragment.performGetLayoutInflater(SourceFile:1478)  at androidx.fragment.app.l.a(SourceFile:1361)  at androidx.fragment.app.l.j(SourceFile:1668)  at androidx.fragment.app.l.i(SourceFile:1748)  at androidx.fragment.app.l.a(SourceFile:1812)  at androidx.fragment.app.a.g(SourceFile:446)  at androidx.fragment.app.l.a(SourceFile:2598)  at androidx.fragment.app.l.b(SourceFile:2386)  at androidx.fragment.app.l.c(SourceFile:2341)  at androidx.fragment.app.l.c(SourceFile:2244)  at androidx.fragment.app.l$c.run(SourceFile:422)  at android.os.Handler.handleCallback(Handler.java:739)  at android.os.Handler.dispatchMessage(Handler.java:95)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5254)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 

aminography commented 4 years ago

Add below line in your project's ProGuard rules to keep them from obfuscation: -keep class com.aminography.primedatepicker.** { *; }

azaz5959 commented 4 years ago

I've already tried that approach and it doesn't work. I also tried to use @Keep annotation for PrimeCalenderView class but it failed again. Note that I downloaded this library and added to my project as local module but I don't think this makes any difference.

aminography commented 4 years ago

Please update the dependency to version 1.1.0 and try again.