霍尼韦尔扫描仪。 java.lang.IllegalArgumentException:服务意图必须是显式的

时间:2018-03-19 11:12:25

标签: android android-intent honeywell

我使用霍尼韦尔SKD扫描条形码。 在Android 4.4.1上一切正常,但在7.7.1我得到了错误。 我试图使用推荐的服务意图,但很可能是我做错了。

Intent serviceIntent = new Intent("com.honeywell.decoderservice.STARTSERVICE");
serviceIntent.setPackage("com.honeywell.decoderservice");
mDecodeManager = new DecodeManager(this, ScanResultHandler); // this line throws exception

我的错误日志:

E/AndroidRuntime: FATAL EXCEPTION: main
              Process: md.avalon.avalontsd, PID: 3288
              java.lang.RuntimeException: Unable to start activity ComponentInfo{md.avalon.avalontsd/md.avalon.avalontsd.ReceiptActivity}: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.honeywell.decoderservice.STARTSERVICE }
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
                  at android.app.ActivityThread.-wrap12(ActivityThread.java)
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
                  at android.os.Handler.dispatchMessage(Handler.java:102)
                  at android.os.Looper.loop(Looper.java:154)
                  at android.app.ActivityThread.main(ActivityThread.java:6130)
                  at java.lang.reflect.Method.invoke(Native Method)
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
               Caused by: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.honeywell.decoderservice.STARTSERVICE }
                  at android.app.ContextImpl.validateServiceIntent(ContextImpl.java:1346)
                  at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1455)
                  at android.app.ContextImpl.bindService(ContextImpl.java:1423)
                  at android.content.ContextWrapper.bindService(ContextWrapper.java:636)
                  at com.honeywell.decodemanager.DecodeManager.bindDecoderService(DecodeManager.java:121)
                  at com.honeywell.decodemanager.DecodeManager.<init>(DecodeManager.java:211)
                  at md.avalon.avalontsd.ReceiptActivity.onCreate(ReceiptActivity.java:181)
                  at android.app.Activity.performCreate(Activity.java:6720)
                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)

如何解决问题? 谢谢。

0 个答案:

没有答案