我知道已經有很多問題了。我一直在經歷所有這些,但仍然無法解決我的問題。Android:ClassNotFoundException同時包括ZXing
我被要求擴展一個已經存在的基於PhoneGap
的android應用程序。我檢查了回購的來源,並意識到第一個開發人員包括一些library
爲dependency
。我按照指示here,建立在core
的ZXing
不是build.xml
對於ant
。
我經歷了XZing Getting started的指示,建立了我自己的core-2.3.jar
試圖包括,但失敗了。與core.jar
相同
我在/libs
文件夾中包含了罐子,導入的是external jar
,沒有任何工作。我真的得到以下錯誤每次:
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)
清單,聲明如下所示:
<!-- 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
?
嗨aracem,謝謝你的回答。我只是意識到,該項目需要XZing PhoneGap插件,而不是XZing庫... – longilong