Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ZXingTestActivity - barcode scanner - No Activity found to handle Intent { act=com.google.zxing.client.android.SCAN (has extras) }

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.

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

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)

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

So what am I missing here ? Thank you!!

like image 526
Giovani C Avatar asked Aug 09 '12 13:08

Giovani C


1 Answers

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" />
like image 92
Siraj Hussain Avatar answered Sep 20 '22 16:09

Siraj Hussain