0

I am facing a strange issue. My application is using Zxing scanner. When I am running my application in emulator everything works well. But when I am installing the application in phone and when I start the scanner first time, application simply crashes. If I start the scanner second time, it works perfects. Crashing only happens when I open the application in a phone first time.

I tried to connect the phone with eclipse and directly ran the application after uninstalling previous versions. I just wanted to see the error log. But when I ran the application like that, it worked perfectly (same way it works in an emulator). Now I am really confused why this issue is happening. Please help me to find a solution.

roy mathew
  • 7,782
  • 4
  • 29
  • 40
  • 1
    You mean when you debug directly from the device in Eclipse,it runs fine? – alvinarul Jun 18 '13 at 10:11
  • @AlvinArulselvan: Yes, I connected my device to the PC using USB and selected the device while running the application. Application started in my device and it worked in the same way it used to work in emulator. Problem is happening when I install it on the device without the help of eclipse.When I run in it device, first time it takes a bit time to load and finally crashes. After that, this issue will not appear. It only appears first time after installation. – roy mathew Jun 18 '13 at 10:14
  • 1
    Without logcat, its tough to imagine your crash – Siddharth Jun 18 '13 at 10:16

1 Answers1

3

I solved this issue by commending out the sections which calls "HelpActivity.class".

That means open CaptureActivity class in the zxing library and comment out the contents inside the method showHelpOnFirstLaunch()

I think this issue happened after the SDK and ADT updation. But the above solution solved the issue.

roy mathew
  • 7,782
  • 4
  • 29
  • 40
  • 1
    Please don't copy and paste our Barcode Scanner app. You are probably causing our app problems because you have retained manifest declarations in our namespace and cloned the UI. – Sean Owen Jun 19 '13 at 07:54
  • @SeanOwen: I am quoting a comment of yours here: "Surely your project does not involve copying the Barcode Scanner UI -- or else, you would have to use zxing. That is indeed not cool. Reusing the scanning library inside your own app is just fine. I'm speaking out against near-total copy and paste jobs. – Sean Owen" I got it from this link: http://stackoverflow.com/questions/10782354/android-qr-code-library-not-zxing Can you explain what you meant in the quoted comment? – roy mathew Jun 20 '13 at 08:45
  • Pretty much exactly what it says. Use the source code as allowed by the open source license. It doesn't allow you to copy the UI as-is. Also, copying our manifest/namespaces is wrong and interferes with the app. These things almost always happen when someone starts by copying our app. So, don't do that. Write your own app, and reuse parts like the core scanning library as needed. https://code.google.com/p/zxing/wiki/LicenseQuestions – Sean Owen Jun 20 '13 at 08:50
  • @SeanOwen: So what if I include the zxing as a library like mentioned in this post http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app-natively-using-eclipse/#comment-159 and follow the instructions in this post : http://stackoverflow.com/questions/1007338/can-i-use-a-library-under-the-apache-software-license-2-0-in-a-commercial-applic Will that solve the issue to an extent? Or the only solution is to follow the suggestion from your side? – roy mathew Jun 20 '13 at 10:47
  • I think I've explained as much as possible. No you can't clone the UI just because a tutorial shows how to do it. Write a slightly different UI. Write your own manifest. It is not hard to understand or do. – Sean Owen Jun 20 '13 at 11:16