【问题标题】:Android App with its Barcode Scanner issue with Zxing resources带有条码扫描器问题的 Android 应用程序与 Zxing 资源有关
【发布时间】:2013-10-24 21:52:14
【问题描述】:

我正在尝试在我的应用程序中实现条码扫描器,该应用程序使用 ZXING 源构建它。

我采用了最新的可用 Zxing 源,现在我将它作为一个 Android 库项目。我还成功地从我的应用程序中引用了这个库。

但是在运行时我得到资源未找到异常。

                 java.lang.RuntimeException: Unable to start activity              
                  ComponentInfo{com.android.m2m/com.google.zxing.client.android.CaptureActivity}:
                  android.content.res.Resources$NotFoundException: File res/xml/preferences.xml from  
                  drawable resource ID #0x7f050000

我在我的应用程序清单 XML 中也提到了 CaptureActivity..

            <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>

有什么我想做的事情,以便可以提取 Zxing 源中的资源吗?

【问题讨论】:

    标签: android zxing barcode-scanner android-library


    【解决方案1】:

    我找到了解决方案。

    问题是 zxing 的来源不打算用作图书馆。肖恩在下面的帖子中得到了答案。

    Zxing project as library in a project won't build

    我尝试在这个 CaptureActivity 项目中限制我的应用,添加我的活动和资源并相应地修改其清单文件。

    【讨论】:

      【解决方案2】:

      您是否在活动代码中使用 ZXing 中的 R 类?有时这只是一个导入问题。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-04-22
        • 1970-01-01
        • 2013-05-25
        • 1970-01-01
        • 2015-09-30
        相关资源
        最近更新 更多