i'm having an issue with proguard
.
After adding proguard
, i was getting warnings :
Warning: com.actionbarsherlock.internal.ActionBarSherlockCompat: can't find referenced class com.actionbarsherlock.BuildConfig Warning: com.slidingmenu.lib.CustomViewBehind: can't find referenced class com.slidingmenu.lib.R$id Warning: com.slidingmenu.lib.CustomViewBehind: can't find referenced class com.slidingmenu.lib.R$id Warning: com.slidingmenu.lib.CustomViewBehind: can't find referenced class com.slidingmenu.lib.R 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: org.solovyev.android.checkout.ActivityCheckout: can't find referenced class javax.annotation.Nonnull Warning: org.solovyev.android.checkout.ActivityCheckout: can't find referenced class javax.annotation.Nonnull Warning: org.solovyev.android.checkout.ActivityCheckout: can't find referenced class javax.annotation.Nonnull Warning: org.solovyev.android.checkout.ActivityCheckout: can't find referenced class javax.annotation.Nonnull Warning: org.solovyev.android.checkout.ActivityCheckout: can't find referenced class javax.annotation.Nonnull Warning: org.solovyev.android.checkout.ActivityCheckout: can't find referenced class javax.annotation.Nonnull Warning: org.solovyev.android.checkout.ActivityCheckout: can't find referenced class javax.annotation.Nonnull Warning: org.solovyev.android.checkout.ActivityCheckout: can't find referenced class javax.annotation.Nonnull Warning: org.solovyev.android.checkout.ActivityCheckout: can't find referenced class javax.annotation.Nonnull Warning: org.solovyev.android.checkout.ActivityCheckout: can't find referenced class javax.annotation.Nonnull Warning: org.solovyev.android.checkout.ActivityCheckout: can't find referenced class javax.annotation.Nonnull Warning: org.solovyev.android.checkout.ActivityCheckout: can't find referenced class javax.annotation.Nonnull Warning: org.solovyev.android.checkout.ActivityCheckout: can't find referenced class javax.annotation.Nonnull Warning: org.solovyev.android.checkout.ActivityCheckout: can't find referenced class javax.annotation.Nonnull Warning: org.solovyev.android.checkout.ActivityCheckout: can't find referenced class javax.annotation.Nonnull Warning: org.solovyev.android.checkout.ActivityCheckout$1: can't find referenced class javax.annotation.Nonnull Warning: org.solovyev.android.checkout.BaseInventory: can't find referenced class javax.annotation.Nonnull Warning: org.solovyev.android.checkout.BaseInventory: can't find referenced class javax.annotation.Nonnull Warning: org.solovyev.android.checkout.BaseInventory: can't find referenced class javax.annotation.Nonnull
And so on, 661 of them. After looking for response, i've ran into it, this is how it goes :
-dontwarn com.actionbarsherlock.**
-dontwarn org.solovyev.android.**
-dontwarn okio.**
-dontwarn com.slidingmenu.**
I added this to my proguard-android.txt
file, and it fixed an issue(source for this approach : Gradle Build Failure)
But now, size of an .apk file decreased from 10mb to 5mb, and, as you can guess, it's not working, just crashes.
Question: what should i do to both : remove this warnings so .apk would build, and .apk that will be build would be working?
EDIT: I've got the trace of error for release version and it has somethin to do with ormlite library, with this message :
E/AndroidRuntime(16807): java.lang.NoSuchFieldError E/AndroidRuntime(16807): at libcore.reflect.AnnotationAccess.decodeValue(AnnotationAccess.java:688) E/AndroidRuntime(16807): at libcore.reflect.AnnotationAccess.toAnnotationInstance(AnnotationAccess.java:663) E/AndroidRuntime(16807): at libcore.reflect.AnnotationAccess.toAnnotationInstance(AnnotationAccess.java:641) E/AndroidRuntime(16807): at libcore.reflect.AnnotationAccess.getDeclaredAnnotation(AnnotationAccess.java:170) E/AndroidRuntime(16807): at java.lang.reflect.Field.getAnnotation(Field.java:242) E/AndroidRuntime(16807): at com.tojc.ormlite.android.annotation.OrmLiteAnnotationAccessor.getAnnotationColumnName(Unknown Source) E/AndroidRuntime(16807): at com.tojc.ormlite.android.framework.ColumnInfo.(Unknown Source) E/AndroidRuntime(16807): at com.tojc.ormlite.android.framework.TableInfo.(Unknown Source) E/AndroidRuntime(16807): at com.tojc.ormlite.android.framework.MatcherController.addTableClass(Unknown Source) E/AndroidRuntime(16807): at com.tojc.ormlite.android.framework.MatcherController.add(Unknown Source) E/AndroidRuntime(16807): at com.test.kovla.provider.KovlaContentProvider.a(Unknown Source) E/AndroidRuntime(16807): at com.test.kovla.provider.KovlaContentProvider.onCreate(Unknown Source) E/AndroidRuntime(16807): at android.content.ContentProvider.attachInfo(ContentProvider.java:1737) E/AndroidRuntime(16807): at android.content.ContentProvider.attachInfo(ContentProvider.java:1712) E/AndroidRuntime(16807): at android.app.ActivityThread.installProvider(ActivityThread.java:5437) E/AndroidRuntime(16807): at android.app.ActivityThread.installContentProviders(ActivityThread.java:5032) E/AndroidRuntime(16807): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4972) E/AndroidRuntime(16807): at android.app.ActivityThread.access$1600(ActivityThread.java:177) E/AndroidRuntime(16807): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1491) E/AndroidRuntime(16807): at android.os.Handler.dispatchMessage(Handler.java:102) E/AndroidRuntime(16807): at android.os.Looper.loop(Looper.java:135) E/AndroidRuntime(16807): at android.app.ActivityThread.main(ActivityThread.java:5910) E/AndroidRuntime(16807): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(16807): at java.lang.reflect.Method.invoke(Method.java:372) E/AndroidRuntime(16807): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405) E/AndroidRuntime(16807): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200) E/AndroidRuntime(16807): Caused by: java.lang.NoSuchFieldException: INTEGER E/AndroidRuntime(16807): at java.lang.Class.getDeclaredField(Class.java:939) E/AndroidRuntime(16807): at libcore.reflect.AnnotationAccess.decodeValue(AnnotationAccess.java:685)
In fact, i've added -keep class com.tojc.** {*;}
to my proguard-android.txt
and it doesn't help but only specified package right, it wasn't
com.tojc.ormlite.android.annotation.OrmLiteAnnotationAccessor.getAnnotationColumnName(Unknown Source)
before
Edit: If this is the list that was asked in comment :
repositories {
maven { url 'https://maven.fabric.io/public' }
jcenter()
}