安卓:ClassNotFoundException的同时,包括ZXingClassNotFoundException、ZXing

2023-09-07 12:40:33 作者:控制思维。

我知道有很多问题了。我已经经历所有的人,但还是我真的没有能够解决我的问题。

I know there are a lot of questions already. I've been going through all of them, but still I`m not able to solve my issue.

我被要求延长一个已经存在的Andr​​oid应用程序,它是基于的PhoneGap 。我检查了从回购来源,并实现了第一个开发包括一些依赖。我跟着指示这里,建于内核 ZXing 没有任何的build.xml 蚂蚁

I was asked to extend an already existing android app, which is based on PhoneGap. I checked out the sources from a repo, and realized that the first developer included some library as dependency. i followed the instructions here, build in the core of ZXing isn't any build.xmlfor ant.

我在通过的 XZing入门,建立自己的核心2.3.jar 尝试包括,但未能成功。同样的,准备部署 core.jar添加从页面

I went through the instructions at XZing Getting started, build my own core-2.3.jar tried to include, but failed. Same with the ready-deployed core.jar from the page

我列入 /库文件夹中,进口酒坛是外部JAR ,毫无效果。我真的收到以下错误每次:

I included the the jars in the /libs folder, imported is a external jar, nothing worked. I`m getting following error everytime:

07-24 17:09:47.554: E/AndroidRuntime(8113): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{dev.tesobe.mobilepayment/com.google.zxing.client.android.CaptureActivity}: java.lang.ClassNotFoundException: Didn't find class "com.google.zxing.client.android.CaptureActivity" on path: /data/app/dev.tesobe.mobilepayment-1.apk
07-24 17:09:47.554: E/AndroidRuntime(8113):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
07-24 17:09:47.554: E/AndroidRuntime(8113):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
07-24 17:09:47.554: E/AndroidRuntime(8113):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
07-24 17:09:47.554: E/AndroidRuntime(8113):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
07-24 17:09:47.554: E/AndroidRuntime(8113):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-24 17:09:47.554: E/AndroidRuntime(8113):     at android.os.Looper.loop(Looper.java:137)
07-24 17:09:47.554: E/AndroidRuntime(8113):     at android.app.ActivityThread.main(ActivityThread.java:5041)
07-24 17:09:47.554: E/AndroidRuntime(8113):     at java.lang.reflect.Method.invokeNative(Native Method)
07-24 17:09:47.554: E/AndroidRuntime(8113):     at java.lang.reflect.Method.invoke(Method.java:511)
07-24 17:09:47.554: E/AndroidRuntime(8113):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
07-24 17:09:47.554: E/AndroidRuntime(8113):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
07-24 17:09:47.554: E/AndroidRuntime(8113):     at dalvik.system.NativeStart.main(Native Method)
07-24 17:09:47.554: E/AndroidRuntime(8113): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.zxing.client.android.CaptureActivity" on path: /data/app/dev.tesobe.mobilepayment-1.apk
07-24 17:09:47.554: E/AndroidRuntime(8113):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
07-24 17:09:47.554: E/AndroidRuntime(8113):     at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
07-24 17:09:47.554: E/AndroidRuntime(8113):     at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
07-24 17:09:47.554: E/AndroidRuntime(8113):     at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
07-24 17:09:47.554: E/AndroidRuntime(8113):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)

该清单声明看起来是这样的:

The manifest-declaration looks like this:

<!-- ZXing activities --> 
    <activity android:name="com.google.zxing.client.android.CaptureActivity" 
            android:screenOrientation="landscape" 
            android:configChanges="orientation|keyboardHidden" 
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
            android:windowSoftInputMode="stateAlwaysHidden" 
            android:exported="false"> 
        <intent-filter> 
            <action android:name="com.phonegap.plugins.barcodescanner.SCAN"/>
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
    </activity> 
    <activity android:name="com.google.zxing.client.android.encode.EncodeActivity" 
        android:label="@string/share_name"> 
        <intent-filter> 
            <action android:name="com.phonegap.plugins.barcodescanner.ENCODE"/> 
            <category android:name="android.intent.category.DEFAULT"/> 
        </intent-filter>
    </activity>

因此​​,任何人任何想法,为什么我不能够包含 CaptureActivity

推荐答案

您应该确保:

的ZXing库添加到您的libs目录 导入ZXing库中的性能/构建路径 确认 - 这是最重要的组成部分 - 选项卡中的排序和导出,认为Android的私人图书馆被激活

通常情况下,最后的Eclipse插件Android的这一切proccess是自动的。尽量让Android的私人图书馆。

Normally, with the last Eclipse Android Plugins all this proccess is automatic when paste a jar inside the libs directory but there are some problems when add new libraries in old proyects. Try to enable the android private libraries.

ExtraBall:如果你只是想捕捉吧codeS,你可以试试这个叉Zxing的,唯一不可缺少的ZXing的 HTTP://$c$c.google.com/p/android-zxinglib/

ExtraBall: If you only want to capture barcodes you can try this fork of Zxing with the only indispensable of ZXing http://code.google.com/p/android-zxinglib/

 
精彩推荐