无活动处理意向{行动= com.google.zxing.client.android.SCAN猫= [英] No activity found to handle intent{act=com.google.zxing.client.android.SCAN cat=

查看:1799
本文介绍了无活动处理意向{行动= com.google.zxing.client.android.SCAN猫=的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到:
android.content.ActivityNotFoundException:无活动处理意向{行动= com.google.zxing.client.android.SCAN猫= [android.intent.category.DEFAULT] FLG = 0x4080000 PKG = com.google.zxing.client。安卓}
 当我运行自己的应用程序集成zxing酒吧code扫描仪。没有logcat的。

I got: android.content.ActivityNotFoundException: No activity found to handle intent{ act=com.google.zxing.client.android.SCAN cat=[android.intent.category.DEFAULT] flg=0x4080000 pkg=com.google.zxing.client.android} when I run my own app integrated with zxing barcode scanner. There is no logcat.

首先我下载的源$ C ​​$ C从zxing并建立它变成一个应用程序,并运行正常的话,我把它变成一个库,我的应用程序并运行我的应用程序,然后得到上述错误。以下是如何开启zxing吧code扫描仪转化为我的应用程序一个lib:

First of all I downloaded source code from zxing and build it into an app and runs fine, then I turn it into a library for my app and run my app then got the error above. Here are how to turn zxing barcode scanner into a lib for my app:

我。上的myapp的Andr​​oidManifest.xml,添加

I. on myapp's AndroidManifest.xml, add

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

二。上的myapp的MainActivity.java,我有这块code的:

II. on myapp's MainActivity.java, I have this piece of code:

      String package_name="com.google.zxing.client.android";

      Intent iScan = new Intent(package_name+".SCAN");

      iScan.setPackage(package_name);

      iScan.addCategory(Intent.CATEGORY_DEFAULT);

      iScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

      iScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);

      iScan.putExtra("SCAN_WIDTH", 420);

      iScan.putExtra("SCAN_HEIGHT", 420);

      iScan.putExtra("RESULT_DISPLAY_DURATION_MS", 3000L);

      iScan.putExtra("SCAN_MODE", "QR_CODE_MODE");

      iScan.putExtra("PROMPT_MESSAGE", "Scan the Contact");

           startActivityForResult(iScan, 0);      

三。在我的项目属性 - > Android的,

III. On my Project Properties->Android,

add  com.google.xing.client.android as lib and copy 

com.google.xing.client.android.captureactivity.jar core.jar添加到LIBS我的应用程序的目录

com.google.xing.client.android.captureactivity.jar core.jar to libs dir of my app

推荐答案

您不要添加的Andr​​oid / ,甚至核心/ ,您的项目,如果你是通过整合意向。事实上,这是强烈反对,主要是因为你上面贴什么:你的应用程序是说它可以搞定吧code扫描仪应该处理意图。那也不行 - 你可能会拦截到我们的应用程序调用

You do not add android/, or even core/, to your project if you are integrating by Intent. In fact this is strongly discouraged, mostly because of exactly what you've posted above: your app is saying it can handle Intents that Barcode Scanner is supposed to handle. That's not OK -- you're potentially intercepting calls to our app.

既然你已经被整合意向,不与任何打扰这个。所有你需要的是什么,是在 Android的整合/ 。请参见 HTTP://$c$c.google.com/p/zxing/维基/ ScanningViaIntent

Since you are already integrating by Intent, don't bother with any of this. All you need is what is in android-integration/. See http://code.google.com/p/zxing/wiki/ScanningViaIntent

如果您使用 IntentIntegrator ,因为描述的,它会处理安装应用程序,所以你不要在 ActivityNotFoundException 您在上面显示。

If you use IntentIntegrator as described there, it will handle installing the app so you don't trip over the ActivityNotFoundException you show above.

这篇关于无活动处理意向{行动= com.google.zxing.client.android.SCAN猫=的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆