thisfeng / EpsonPrinterSample

EPSON SDK for Android ,打印处理
45 stars 12 forks source link

couldn't find "libepos2.so" #1

Open Aswinhub opened 6 years ago

Aswinhub commented 6 years ago

i have done the same as you did. But when i initialize the printer i get this error

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.swishpay.tab-3/base.apk"],nativeLibraryDirectories=[/data/app/com.swishpay.tab-3/lib/x86, /vendor/lib, /system/lib]]] couldn't find "libepos2.so" at java.lang.Runtime.loadLibrary(Runtime.java:366) at java.lang.System.loadLibrary(System.java:989) at com.epson.epos2.printer.CommonPrinter.<clinit>(CommonPrinter.java:214) at com.swishpay.tab.EposService.initialize(EposService.java:25) at com.swishpay.tab.EposService.print(EposService.java:20) at com.swishpay.tab.activities.logins.OrganizationLogin.onClick(OrganizationLogin.java:99) at android.view.View.performClick(View.java:4757) at android.view.View$PerformClick.run(View.java:19766) 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:5255) 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:839) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)

thisfeng commented 6 years ago

Sorry to reply to you now, I think you are missing the "libepos2.so" file in JniLibs, if you download my example should not be a problem. Examples of this directory file you can find out.😊

SunryTeang commented 6 years ago

i got message what what it error? Process: com.epson.epos2_printer, PID: 6520 java.lang.UnsatisfiedLinkError: No implementation found for int com.epson.epos2.Log.nativeEpos2SetLogSettings(java.lang.String, int, int, java.lang.String, int, int, int) (tried Java_com_epson_epos2_Log_nativeEpos2SetLogSettings and Java_com_epson_epos2_Log_nativeEpos2SetLogSettings__Ljava_lang_String_2IILjava_lang_String_2III) at com.epson.epos2.Log.nativeEpos2SetLogSettings(Native Method) at com.epson.epos2.Log.setLogSettings(Log.java:43) at cam.shushi.pos.test.MainActivity.onCreate(MainActivity.java:23) at android.app.Activity.performCreate(Activity.java:6237) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) at android.app.ActivityThread.-wrap11(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.ja

Aswinhub commented 6 years ago

@SunryTeang
Try adding NDK to in your app gradle in default config `splits{ abi{ include 'armeabi-v5a', 'armeabi-v7a', 'x86', 'armeabi' } }

add this after default config sourceSets { main { jniLibs.srcDirs = ['src/main/jniLibs/'] } } ` NOTE : printer wont work in emulator

thisfeng commented 6 years ago

yes, tips !! printer wont work in emulator @SunryTeang note gradle config , If you want to debug, you also need to make your phone wireless debugging 。 thanks bro Reply 😁 @Aswinhub

SunryTeang commented 6 years ago

thank you i fix it done but i got new error like this --------- beginning of main try { Log.setLogSettings(this, Log.PERIOD_TEMPORARY, Log.OUTPUT_STORAGE, "192.168.160.107", 0, 1, Log.LOGLEVEL_LOW); } catch (Exception e) { android.util.Log.e("error",""+e.getMessage()); //this.showException(e, "setLogSettings", tis); } }

05-02 14:19:31.955 5071-5071/com.epson.epos2_printer E/art: No implementation found for int com.epson.epos2.Log.nativeEpos2SetLogSettings(java.lang.String, int, int, java.lang.String, int, int, int) (tried Java_com_epson_epos2_Log_nativeEpos2SetLogSettings and Java_com_epson_epos2_Log_nativeEpos2SetLogSettingsLjava_lang_String_2IILjava_lang_String_2III) 05-02 14:19:31.955 5071-5071/com.epson.epos2_printer E/AndroidRuntime: FATAL EXCEPTION: main Process: com.epson.epos2_printer, PID: 5071 java.lang.UnsatisfiedLinkError: No implementation found for int com.epson.epos2.Log.nativeEpos2SetLogSettings(java.lang.String, int, int, java.lang.String, int, int, int) (tried Java_com_epson_epos2_Log_nativeEpos2SetLogSettings and Java_com_epson_epos2_Log_nativeEpos2SetLogSettingsLjava_lang_String_2IILjava_lang_String_2III) at com.epson.epos2.Log.nativeEpos2SetLogSettings(Native Method) at com.epson.epos2.Log.setLogSettings(Log.java:58) at com.epson.epos2_printer.MainActivity.onCreate(MainActivity.java:84) at android.app.Activity.performCreate(Activity.java:6237) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) at android.app.ActivityThread.-wrap11(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

bluetoothfx commented 5 years ago

Hello, I am also facing same problem. Is it solved? Please let me know. Thanks.

thisfeng commented 5 years ago

Hello, I am also facing same problem. Is it solved? Please let me know. Thanks.

Can you tell me exactly what the mistake is? I think you are missing the "libepos2.so" file in JniLibs image

bluetoothfx commented 5 years ago

Please check for image reference:

Capture_ex

bluetoothfx commented 5 years ago

Error log:

java.lang.UnsatisfiedLinkError: No implementation found for int com.epson.epos2.printer.CommonPrinter.nativeEpos2AddCommand(long, byte[]) (tried Java_com_epson_epos2_printer_CommonPrinter_nativeEpos2AddCommand and Java_com_epson_epos2_printer_CommonPrinter_nativeEpos2AddCommand__J_3B) at com.epson.epos2.printer.CommonPrinter.nativeEpos2AddCommand(Native Method) at com.epson.epos2.printer.CommonPrinter.addCommand(CommonPrinter.java:2054) at com.epson.epos2.printer.Printer.addCommand(Printer.java:12) at com.Android.printers.epson_TM_T82.EpsonTMT82PrinterActivity.createMemo(EpsonTMT82PrinterActivity.java:746) at com.Android.printers.epson_TM_T82.EpsonTMT82PrinterActivity.runPrintSequence(EpsonTMT82PrinterActivity.java:108) at com.Android.printers.epson_TM_T82.EpsonTMT82PrinterActivity.onClick(EpsonTMT82PrinterActivity.java:92) at android.view.View.performClick(View.java:6319) at android.widget.TextView.performClick(TextView.java:11202) at android.view.View$PerformClick.run(View.java:23995) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6816) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1565) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1453)

bluetoothfx commented 5 years ago

Having error inside this sdk method:

public void addCommand(byte[] data) throws Epos2Exception {

    this.outputLogCallFunction("addCommand", data);

    try {
        this.checkHandle();
        if (null == data) {
            throw new Epos2Exception(1);
        }

        int errStatus = this.nativeEpos2AddCommand(this.getEdcHandle(), data);
        if (0 != errStatus) {
            throw new Epos2Exception(errStatus);
        }
    } catch (Epos2Exception var3) {
        this.outputException("addCommand", var3);
        this.outputLogReturnFunction("addCommand", var3.getErrorStatus(), data);
        throw var3;
    }

    this.outputLogReturnFunction("addCommand", 0, data);
}
thisfeng commented 5 years ago

Error log:

java.lang.UnsatisfiedLinkError: No implementation found for int com.epson.epos2.printer.CommonPrinter.nativeEpos2AddCommand(long, byte[]) (tried Java_com_epson_epos2_printer_CommonPrinter_nativeEpos2AddCommand and Java_com_epson_epos2_printer_CommonPrinter_nativeEpos2AddCommand__J_3B) at com.epson.epos2.printer.CommonPrinter.nativeEpos2AddCommand(Native Method) at com.epson.epos2.printer.CommonPrinter.addCommand(CommonPrinter.java:2054) at com.epson.epos2.printer.Printer.addCommand(Printer.java:12) at com.Android.printers.epson_TM_T82.EpsonTMT82PrinterActivity.createMemo(EpsonTMT82PrinterActivity.java:746) at com.Android.printers.epson_TM_T82.EpsonTMT82PrinterActivity.runPrintSequence(EpsonTMT82PrinterActivity.java:108) at com.Android.printers.epson_TM_T82.EpsonTMT82PrinterActivity.onClick(EpsonTMT82PrinterActivity.java:92) at android.view.View.performClick(View.java:6319) at android.widget.TextView.performClick(TextView.java:11202) at android.view.View$PerformClick.run(View.java:23995) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6816) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1565) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1453)


Maybe you need to set up the corresponding so library architecture support, Try two ways

  1. Attempt

    defaultConfig { ... ndk { //add support SO
    abiFilters 'armeabi' //, 'x86', ' 'x86_64', 'arm64-v8a' } }

  2. or Delete other JniLibs file ,Leave only one. armeabi

Please use the real machine to dev debug

bluetoothfx commented 5 years ago

@thisfeng your solution works fine. When I port your solution to my project this problem occurs.

thisfeng commented 5 years ago

@bluetoothfx - -, First debug it with this Demo, and then transplant it to your own project. Or look at the official Demo. xixi😁

https://download.epson-biz.com/modules/pos/index.php?page=soft&scat=61&ml_lang=zh-Cn

bluetoothfx commented 5 years ago

It is already done mate. But problem is happening on my project. Both yours and link examples are working fine. 😄

bluetoothfx commented 5 years ago

@SunryTeang @thisfeng The issue is resolved. Please carefully add the libepos2.so file. Make sure it is 183 kb not over 200 kb there is 2 version for libepos2.so over the internet. But only with 183 kb is working properly. Which can be found with this repository. Thanks everyone.

thisfeng commented 5 years ago

@bluetoothfx Thank you for sharing. good bro 😄

jbringb commented 5 years ago

I tried everything in this thread, but the only fix for me was making a folder armeabi-v7a and placing the so files from armeabi in it.

bbetter commented 5 years ago

Still doesn't work for me any updates on this?

bluetoothfx commented 5 years ago

Hello, take the project and find those library file, it will work. Don't use other .so files.

On Mon, Aug 12, 2019, 6:20 PM Андрій Пугач <notifications@github.com wrote:

Still doesn't work for me any updates on this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/thisfeng/EpsonPrinterSample/issues/1?email_source=notifications&email_token=ABJAWERK4ASAMUH5E4NPYCTQEFIQ5A5CNFSM4EQ3REEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4CLHOQ#issuecomment-520401850, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJAWEXONGYYRR6XVRE6U33QEFIQ5ANCNFSM4EQ3REEA .

bbetter commented 5 years ago

I'm actually using the one from official epson web site So there are armeabi and arm64-v8a folders which I copied to my project as well as latest epos.jar they have.

I renamed armeabi folder to v7a and it works well both on my armeabi-v7a device and arm64 device

But as my app is supposed to be system app - and it's build in as system app (priv - app) it's updated via recovery and that's when it fails with unsatisfied link error.

bluetoothfx commented 5 years ago

Yes, don't use official. There is problem. Use the one found with this project. Also use the android handset which supports this library. Let me know if you don't find .so files from this project.

On Mon, Aug 12, 2019, 7:26 PM Андрій Пугач <notifications@github.com wrote:

I'm actually using the one from official epson web site So there are armeabi and arm64-v8a folders which I copied to my project as well as latest epos.jar they have.

I renamed armeabi folder to v7a and it works well both on my armeabi-v7a device and arm64 device

But as my app is supposed to be system app - and it's build in as system app (priv - app) it's updated via recovery and that's when it fails with unsatisfied link error.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/thisfeng/EpsonPrinterSample/issues/1?email_source=notifications&email_token=ABJAWEXCUBKETXLYC5MMLN3QEFQH3A5CNFSM4EQ3REEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4CQTNA#issuecomment-520423860, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJAWEW4YQOATVGOPJFUWZTQEFQH3ANCNFSM4EQ3REEA .

bbetter commented 5 years ago

But there isn't version for arm64 devices, I do require it for my app

bluetoothfx commented 5 years ago

armeabi-v7a , might serve your purpose. Try to create folder of arm64 and use the same .so file and check if it serves your purpose. Btw I have never done that. Also for arm64 you can try official. I have used only armeabi-v7a on my project.

On Mon, Aug 12, 2019, 7:30 PM Андрій Пугач <notifications@github.com wrote:

But there isn't version for arm64 devices, I do require it for my app

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/thisfeng/EpsonPrinterSample/issues/1?email_source=notifications&email_token=ABJAWEQ6FMYHWBCHYTKRRJTQEFQW3A5CNFSM4EQ3REEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4CQ7CY#issuecomment-520425355, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJAWEUPOVDJRUSLYY3BSMTQEFQW3ANCNFSM4EQ3REEA .

crobinson42 commented 4 years ago

The problem I'm facing is that the Google Play Store requires a 64bit build now - I can only find the 32bit libepos2.so for the epson printer. I copied the armabi-v7a/libepos2.so file to arm64-v8a/libepos2.so then I get this error:

java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/com.hhs2-aVW_aSSxSqm07HJyVyJjvQ==/lib/arm64/libepos2.so" is 32-bit instead of 64-bit

image

bluetoothfx commented 4 years ago

Hello, if possible check epson original website for x64 or other versions. And use the other versions from here.

On Wed, Oct 30, 2019, 9:53 PM Cory Robinson <notifications@github.com wrote:

The problem I'm facing is that the Google Play Store requires a 64bit build now - I can only find the 32bit libepos2.so for the epson printer. I copied the armabi-v7a/libepos2.so file to arm64-v8a/libepos2.so then I get this error:

java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/com.hhs2-aVW_aSSxSqm07HJyVyJjvQ==/lib/arm64/libepos2.so" is 32-bit instead of 64-bit

[image: image] https://user-images.githubusercontent.com/5973579/67873413-ac38a800-faf0-11e9-8b82-ac09ab6a8fe9.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/thisfeng/EpsonPrinterSample/issues/1?email_source=notifications&email_token=ABJAWEXNU7VFMRFVNZLMH63QRGUVXA5CNFSM4EQ3REEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECUXLKY#issuecomment-547976619, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJAWET4CRAG5RO3V5YRSM3QRGUVXANCNFSM4EQ3REEA .

crobinson42 commented 4 years ago

@bluetoothfx thx! I built this app ~4 months ago and they only offered the 32bit on the Epson site.. just checked and they updated to offer the 64bit about a month ago 👍🏼

bluetoothfx commented 4 years ago

Please share the x64 bit link here for future reference. Thanks.

On Wed, Oct 30, 2019, 9:58 PM Cory Robinson <notifications@github.com wrote:

@bluetoothfx https://github.com/bluetoothfx thx! I built this app ~4 months ago and they only offered the 32bit on the Epson site.. just checked and they updated to offer the 64bit about a month ago 👍🏼

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/thisfeng/EpsonPrinterSample/issues/1?email_source=notifications&email_token=ABJAWEUGXHIEVQ5JZCFI5LDQRGVJDA5CNFSM4EQ3REEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECUX6CA#issuecomment-547979016, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJAWEVFNZJRSNEW2DNGG2LQRGVJDANCNFSM4EQ3REEA .

crobinson42 commented 4 years ago

https://download.epson-biz.com/modules/pos/index.php?page=single_soft&cid=6197&pcat=7&pid=3228

thisfeng commented 4 years ago

https://download.epson-biz.com/modules/pos/index.php?page=single_soft&cid=6197&pcat=7&pid=3228

thx bro shared !good luck _

EthanCents commented 4 years ago

Did anybody find a solution for this? I'm using the jniLibs provided by Epson in their actual SDK package, but getting the same issues.

bluetoothfx commented 4 years ago

@EthanCents please read the thread. I hope this will solve the issue.

EthanCents commented 4 years ago

So just use the libepos2.so found in this package, not the package provided by Epson?

bluetoothfx commented 4 years ago

yes & also don't forget to give x64 based libpos.so otherwise in play store it will not upoload or will not work advance phone.

thisfeng commented 4 years ago

my all project used this libepos2.so and ePOS2.jar , is very stable ,Rest assured to use 。 If you want to use the official new demo, please download the official new demo, not the demo I modified

EthanCents commented 4 years ago

Yeah, I'm building my own integration with the Epson Android SDK so I'm using the most up-to-date documentation and version of their SDK and docs. However, I'm still getting this error myself, so was curious if there were any other solutions that people have tried to solve this, outside of using your libepos2.so file - I've added yours to my own code but am still getting the same error

thisfeng commented 4 years ago

Yeah, I'm building my own integration with the Epson Android SDK so I'm using the most up-to-date documentation and version of their SDK and docs. However, I'm still getting this error myself, so was curious if there were any other solutions that people have tried to solve this, outside of using your libepos2.so file - I've added yours to my own code but am still getting the same error

I recently discovered during testing that it does indeed work by using an older version of libepos2.so in my project, and I'm getting the same error in the official one using the latest documentation. ,Please only add support for armeabi if you want it to work ,

 ndk {
        //add support SO  USB EPSON Need
        abiFilters 'armeabi'//, 'x86'//, ' 'x86_64', 'arm64-v8a'
    }

I also tested it with other official 64 systems .so , but it didn't work and the official Android Demo is not updated !...