Android Errors in released app with ProGuard

I have done a app in which I am Using EPSON Printer SDK So there I Have some Library files for EPSON thermal printer I am using them In my app

So here App is running Successfully and I am printing the data

Now I made a Release Version of my apk and Signed it

My app is in different package(com.mytest.mapp) and printer is in other package (com.epson.epos2_printer) and I am using library libepos2.so

So its crashing when I try to print the application

I followed many proguard forms and I have added this in proguard-rules

-keep class  com.epson.epos2** {
    *;
}

But am still facing same issue when minifyEnabled true

If its false its working fine for Release version can any 1 suggest me what I am missing for EPSON SDK library

This is my error Log

   No pending exception expected: java.lang.ClassNotFoundException: Didn't find class "com.epson.epsonio.bluetooth.NetBt" on path: DexPathList[[zip file "/data/app/com.mytest.mapp-1/base.apk"],nativeLibraryDirectories=[/data/app/com.mytest.mapp-1/lib/arm, /vendor/lib, /system/lib]]
   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:511)
   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:469)
   at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String) (Runtime.java:-2)
   at java.lang.String java.lang.Runtime.doLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:428)
   at void java.lang.Runtime.loadLibrary(java.lang.String, java.lang.ClassLoader) (Runtime.java:369)
   at void java.lang.System.loadLibrary(java.lang.String) (System.java:989)
   at void com.epson.epos2.discovery.Discovery.<clinit>() ((null):-1)
   at void com.mytest.mapp.pdata.PrintMActivity.onCreate(android.os.Bundle) ((null):-1)
   at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6289)
   at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1119)
   at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2655)
   at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2767)
   at void android.app.ActivityThread.access$900(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:177)
   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1449)
   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
   at void android.os.Looper.loop() (Looper.java:145)
   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:5951)
   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[], boolean) (Method.java:-2)
   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:372)
   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1400)
   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1195)

Answer

I also Got Same error With Bluetooth printer and Epson Printer.. Better to use

-ignorewarnings / -dontwarn class/package name
-keep class * {
    public private *;
}

Dot forget to Keep our class/package name

Hope this works

Leave a Reply

Your email address will not be published. Required fields are marked *