找不到用于处理Intent的活动

找不到用于处理Intent的活动

本文介绍了ZXingTestActivity-条形码扫描仪-找不到用于处理Intent的活动{act = com.google.zxing.client.android.SCAN(有其他功能)}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试构建使用条形码扫描器的应用程序,并且我决定尝试在 ZXing-2.0.zip 中找到的示例,所以我进食了,将 androidtest 应用程序作为现有的android应用程序导入到我的工作区中,代码可以正常编译,没有错误.

I've been trying to build an application that uses barcode scanner, and I've decided to try out the example found in the ZXing-2.0.zip ,so I went in my eclipse and imported the androidtest application as an existing android application into my workspace, the code compiles ok with no errors.

现在,在我的AVD上运行该应用程序后,所有按钮都应正确显示

Now after running the app on my AVD all the buttons appear right as it should be

单击扫描产品按钮时,它将在LogCat中显示此堆栈,并且该应用程序需要关闭:

When clicking scan product button it gives me this stack in the LogCat and the application needs to close:


08-09 13:10:47.542: E/AndroidRuntime(681): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.google.zxing.client.android.SCAN (has extras) }
08-09 13:10:47.542: E/AndroidRuntime(681):  at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1545)
08-09 13:10:47.542: E/AndroidRuntime(681):  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1416)
08-09 13:10:47.542: E/AndroidRuntime(681):  at android.app.Activity.startActivityForResult(Activity.java:3351)
08-09 13:10:47.542: E/AndroidRuntime(681):  at android.app.Activity.startActivityForResult(Activity.java:3312)
08-09 13:10:47.542: E/AndroidRuntime(681):  at com.google.zxing.client.androidtest.ZXingTestActivity$3.onClick(ZXingTestActivity.java:153)
08-09 13:10:47.542: E/AndroidRuntime(681):  at android.view.View.performClick(View.java:4084)
08-09 13:10:47.542: E/AndroidRuntime(681):  at android.view.View$PerformClick.run(View.java:16966)
08-09 13:10:47.542: E/AndroidRuntime(681):  at android.os.Handler.handleCallback(Handler.java:615)
08-09 13:10:47.542: E/AndroidRuntime(681):  at android.os.Handler.dispatchMessage(Handler.java:92)
08-09 13:10:47.542: E/AndroidRuntime(681):  at android.os.Looper.loop(Looper.java:137)
08-09 13:10:47.542: E/AndroidRuntime(681):  at android.app.ActivityThread.main(ActivityThread.java:4745)
08-09 13:10:47.542: E/AndroidRuntime(681):  at java.lang.reflect.Method.invokeNative(Native Method)
08-09 13:10:47.542: E/AndroidRuntime(681):  at java.lang.reflect.Method.invoke(Method.java:511)
08-09 13:10:47.542: E/AndroidRuntime(681):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
08-09 13:10:47.542: E/AndroidRuntime(681):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
08-09 13:10:47.542: E/AndroidRuntime(681):  at dalvik.system.NativeStart.main(Native Method)

这很奇怪,因为他正在谈论的活动应该是ZXingTestActivity

This is rather weird because because the activity he's talking about should be ZXingTestActivity

那我在这里想念什么?谢谢!!

So what am I missing here ? Thank you!!

推荐答案

只需将此代码添加到清单文件中,并带有Application标签即可.

Just Add this Code into your manifest file, with in the Application tag.

<activity
    android:name="com.google.zxing.client.android.CaptureActivity"
    android:configChanges="orientation|keyboardHidden"
    android:screenOrientation="landscape"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
    android:windowSoftInputMode="stateAlwaysHidden" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    <intent-filter>
        <action android:name="com.google.zxing.client.android.SCAN" />

        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</activity>

如果尚未添加到文件顶部,请立即添加权限

Now add permission if not already added on the top of file

 <uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />

这篇关于ZXingTestActivity-条形码扫描仪-找不到用于处理Intent的活动{act = com.google.zxing.client.android.SCAN(有其他功能)}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 02:36