Zxing Causing Android App to Force Close?

Zxing is not doing anything here. You copied and pasted our code, and have not included it in your JAR. You are simply seeing a ClassNotFoundException you're not even getting to the point where you use our code.

Up vote 0 down vote favorite share g+ share fb share tw.

Whenever the activity that initiates the scan happens, the android application force closes. It worked at one point and suddenly won't work anymore. Core.

Jar is in a lib folder. Logcat: 11-08 18:13:16.490: E/AndroidRuntime(1667): FATAL EXCEPTION: main 11-08 18:13:16.490: E/AndroidRuntime(1667): java.lang. RuntimeException: Unable to instantiate activity ComponentInfo{com.picky.

Pickyeater/libcom.google.zxing.client.android. CaptureActivity}: java.lang. ClassNotFoundException: libcom.google.zxing.client.android.

CaptureActivity in loader dalvik.system. PathClassLoader/data/app/com.picky. Pickyeater-1.

Apk 11-08 18:13:16.490: E/AndroidRuntime(1667): at android.app.ActivityThread. PerformLaunchActivity(ActivityThread. Java:2585) 11-08 18:13:16.490: E/AndroidRuntime(1667): at android.app.ActivityThread.

HandleLaunchActivity(ActivityThread. Java:2679) 11-08 18:13:16.490: E/AndroidRuntime(1667): at android.app.ActivityThread. Access$2300(ActivityThread.

Java:125) 11-08 18:13:16.490: E/AndroidRuntime(1667): at android.app. ActivityThread$H. HandleMessage(ActivityThread.

Java:2033) 11-08 18:13:16.490: E/AndroidRuntime(1667): at android.os.Handler. DispatchMessage(Handler. Java:99) 11-08 18:13:16.490: E/AndroidRuntime(1667): at android.os.Looper.

Loop(Looper. Java:123) 11-08 18:13:16.490: E/AndroidRuntime(1667): at android.app.ActivityThread. Main(ActivityThread.

Java:4627) 11-08 18:13:16.490: E/AndroidRuntime(1667): at java.lang.reflect.Method. InvokeNative(Native Method) 11-08 18:13:16.490: E/AndroidRuntime(1667): at java.lang.reflect.Method. Invoke(Method.

Java:521) 11-08 18:13:16.490: E/AndroidRuntime(1667): at com.android.internal.os. ZygoteInit$MethodAndArgsCaller. Run(ZygoteInit.

Java:868) 11-08 18:13:16.490: E/AndroidRuntime(1667): at com.android.internal.os.ZygoteInit. Main(ZygoteInit. Java:626) 11-08 18:13:16.490: E/AndroidRuntime(1667): at dalvik.system.NativeStart.

Main(Native Method) 11-08 18:13:16.490: E/AndroidRuntime(1667): Caused by: java.lang. ClassNotFoundException: libcom.google.zxing.client.android. CaptureActivity in loader dalvik.system.

PathClassLoader/data/app/com.picky. Pickyeater-1. Apk 11-08 18:13:16.490: E/AndroidRuntime(1667): at dalvik.system.PathClassLoader.

FindClass(PathClassLoader. Java:243) 11-08 18:13:16.490: E/AndroidRuntime(1667): at java.lang.ClassLoader. LoadClass(ClassLoader.

Java:573) 11-08 18:13:16.490: E/AndroidRuntime(1667): at java.lang.ClassLoader. LoadClass(ClassLoader. Java:532) 11-08 18:13:16.490: E/AndroidRuntime(1667): at android.app.Instrumentation.

NewActivity(Instrumentation. Java:1021) 11-08 18:13:16.490: E/AndroidRuntime(1667): at android.app.ActivityThread. PerformLaunchActivity(ActivityThread.

Java:2577) OnCreate(): protected void onCreate(Bundle savedInstanceState) { super. OnCreate(savedInstanceState); Intent intent = new Intent("com.google.zxing.client.android. SCAN"); intent.

PutExtra("SCAN_MODE", "PRODUCT_MODE"); startActivityForResult(intent, 0); } AndroidManifest. Xml excerpt: . Classpath: android zxing link|improve this question edited 11-08 at 18:57 asked 11-08 at 2:24Kristin53.

– Amy88 Nov 9 '11 at 4:08 It's not a package - it's a jar on the build path – Kristin Nov 9 '11 at 4:50 Seems like the jar is not present in the build path. You need to add the core. Jar to your project (Right-click your project –> Properties –> Java Build Path –> Add External JARS… –> Select core.

Jar –> OK). – Amy88 Nov 9 '11 at 5:15 Yeah it's definitely in there. I've tried taking it out and reimporting it, but no-go – Kristin Nov 9 '11 at 5:29 Could you please post the content of your .

Classpath file? Is your lib folder in your project's root folder? – Amy88 Nov 9 '11 at 5:44.

Zxing is not doing anything here. You copied and pasted our code, and have not included it in your JAR. You are simply seeing a ClassNotFoundException; you're not even getting to the point where you use our code.

FWIW we strongly discourage this level of copy-and-paste of our open source code. Please write your own application to start, and reuse pieces that you need. From the error, it seems this is not what you are going.

More strongly, you should not be using our package name.

Wait I'm confused. I really didn't mean to copy anything. We just followed the directions for including the jar.

How do you suggest we correctly access the scanning? Our package name is com.picky. Pickyeater – Kristin Nov 9 '11 at 18:35 Something in your layout is referencing 'libcom.google.zxing.client.android.

CaptureActivity' and that is the root of the problem. I am not sure what instructions you are following, but you shouldn't need to include anything except core. Jar not anything from android/ – Sean Owen Nov 9 '11 at 18:45 There isn't anything in our project from android/.

Is how we're referencing it the section in our Manifest incorrect? Or the reference to SCAN in the OnCreate()? – Kristin Nov 9 '11 at 19:06 I don't know your app, so I couldn't tell you.

I can see a reference to our package from android/. You must have copied something. I imagine that's your problem then, that you're using bits of our code when you don't know it or realize it and it's causing problems.

– Sean Owen Nov 9 '11 at 19:44 Thanks for the help - you were right. My teammates included it as a library instead of a jar, and I included the jar not realizing that's not how they did it. – Kristin Nov 9 '11 at 20:09.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions