Search code examples
androidzxingqr-codescanning

ZXing - FATAL EXCEPTION: Unable to instantiate activity ComponentInfo{..CaptureActivity}


Here is the stacktrace:

04-10 18:09:36.393: E/AndroidRuntime(26592): FATAL EXCEPTION: main
04-10 18:09:36.393: E/AndroidRuntime(26592): java.lang.RuntimeException: Unable to        instantiate activity     ComponentInfo{org.jujitsu.app.com/com.google.zxing.client.android.CaptureActivity}:     java.lang.ClassNotFoundException: com.google.zxing.client.android.CaptureActivity in loader    dalvik.system.PathClassLoader[/data/app/org.jujitsu.app.com-1.apk]
04-10 18:09:36.393: E/AndroidRuntime(26592):    atandroid.app.ActivityThread.performLaunchActivity(ActivityThread.java:1738)
04-10 18:09:36.393: E/AndroidRuntime(26592):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1837)
04-10 18:09:36.393: E/AndroidRuntime(26592):    at android.app.ActivityThread.access$1500(ActivityThread.java:132)
04-10 18:09:36.393: E/AndroidRuntime(26592):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1033)
04-10 18:09:36.393: E/AndroidRuntime(26592):    at android.os.Handler.dispatchMessage(Handler.java:99)
04-10 18:09:36.393: E/AndroidRuntime(26592):    at android.os.Looper.loop(Looper.java:143)
04-10 18:09:36.393: E/AndroidRuntime(26592):    at android.app.ActivityThread.main(ActivityThread.java:4196)
04-10 18:09:36.393: E/AndroidRuntime(26592):    at java.lang.reflect.Method.invokeNative(Native Method)
04-10 18:09:36.393: E/AndroidRuntime(26592):    at java.lang.reflect.Method.invoke(Method.java:507)
04-10 18:09:36.393: E/AndroidRuntime(26592):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-10 18:09:36.393: E/AndroidRuntime(26592):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-10 18:09:36.393: E/AndroidRuntime(26592):    at dalvik.system.NativeStart.main(Native Method)
04-10 18:09:36.393: E/AndroidRuntime(26592): Caused by: java.lang.ClassNotFoundException: com.google.zxing.client.android.CaptureActivity in loader dalvik.system.PathClassLoader[/data/app/org.jujitsu.app.com-1.apk]
04-10 18:09:36.393: E/AndroidRuntime(26592):    at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
04-10 18:09:36.393: E/AndroidRuntime(26592):    at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
04-10 18:09:36.393: E/AndroidRuntime(26592):    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
04-10 18:09:36.393: E/AndroidRuntime(26592):    at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
04-10 18:09:36.393: E/AndroidRuntime(26592):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1730)
04-10 18:09:36.393: E/AndroidRuntime(26592):    ... 11 more

Here is my Manifest Declaration.

<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">
<intent-filter>
  <action android:name="android.intent.action.MAIN"/>
  <category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<intent-filter>
  <action android:name="com.google.zxing.client.android.SCAN"/>
  <category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>

Here is when/where the error occurs:

public void onClick(View v){
 Intent intent = new Intent("com.google.zxing.client.android.SCAN");
 intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
 startActivityForResult(intent, 0);
 }

It works alright when I select a random QR code reader I have but when I use the application as a QR code reader it gives this error.

Im a bit confused as to why it is doing it... I have the core.jar in my referenced libraries in my eclipse project also... maybe the core isn't full?


Solution

  • Already answered this on the mailing list. You need to remove all usage of android/ and core/ in your project. None of this was supposed to be present in the first place. Please read and follow http://code.google.com/p/zxing/wiki/ScanningViaIntent