Wednesday 20 June 2012

Integrating Zxing QR Code scanner Into your android Application | ZXing QR Reader | Android - Integrate ZXing QR code scanner


Hello Android Guys,

 Have you facing issue in Integrating QR Code scanner ?  

 Please follow this steps:

android qr code Step1 :Obtain the zxing source code
  Run this command from your terminal(for mac/linux os)
  svn checkout http://zxing.googlecode.com/svn/trunk/ 
  zxing-read-    only
  Also you can find the full source code at this url
  http://code.google.com/p/zxing/source/browse/trunk.               

 Step 2 : Build zxing core using Apache Ant
  You will need to build the core project into a jar file using apache ant
  (download from here http://ant.apache.org/ivy/download.cgi). 
  Using a shell or cmd prompt navigate to the root directory of 
  the downloaded zxing src and execute “ant -f core/build.xml”. 
  This will produce a file core/core.jar which
  we will use in the next step.   
  Download Core.jar from here

 Step 3: Build ZXing Android using Eclipse
  Create a New Android Project (File –> New –> Android Project).
  Set the project name to ZXing (or similar).
  Select the “Create project from existing source” radio button
  Click “Browse” and navigate to the android project that you downloaded from
  zxing  and click “OK” Select “Finish”

  The project will not currently build. We need to add the core.jar file (that we
  produced    in the previous step) into our project. Right-click on ZXing
  project –> properties –> Java Build Path –> Add External Jars –> Navigate to
  and select core.jar –> Open –> OK.

  Actually, while we’re here we should do one more very important thing!
  Right-click on ZXing project –> properties –> Android –> Scroll down and
  check/tick the “Is Library” checkbox –> OK

 Step 4: Include ZXing Android into your project.
   Within Eclipse,  Right-click on YOURPROJECTNAMEHERE project –>
   properties –>Android –> Scroll down to Libraries section –> Click Add –>
   Select ZXing (which should appear as an option as a result of completing
   previous step).


   Here ,I am sharing you a full running Sample code . Just download it, import
   it into your Eclipse and Run.

   1. AndroidManifest.xml

 <?xml version="1.0" encoding="utf-8"?>
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.testqrcode"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="8" />
    <uses-permission android:name="android.permission.CAMERA" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".TestQRCodeActivity"
            android:label="@string/app_name" >
            <intent-filter>
              <action android:name="android.intent.action.MAIN" />

              <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.google.zxing.client.android.CaptureActivity"
            android:configChanges="orientation|keyboardHidden"
            android:screenOrientation="landscape"
            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>
    </application>

  </manifest>
   2. TestQRCodeActivity.java
package com.testqrcode;

import com.google.zxing.client.android.CaptureActivity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class TestQRCodeActivity extends Activity {

 /** Called when the activity is first created. */
 Button b1;
 @Override
 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  setContentView(R.layout.main);
  b1 = (Button) findViewById(R.id.submit);

  b1.setOnClickListener(new OnClickListener() {
   public void onClick(View arg0) {
    // TODO Auto-generated method stub
    Intent intent = new Intent(TestQRCodeActivity.this,
            CaptureActivity.class);
    // Intent intent = new
    // Intent("com.google.zxing.client.android.SCAN");
    intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
    startActivityForResult(intent, 0);
   }
  });
 }

 public void onActivityResult(int requestCode, int resultCode, Intent intent) {
  if (requestCode == 0) {
   if (resultCode == 1) {
    // Handle successful scan
    String capturedQrValue = intent.getStringExtra("RESULT");
    // String format =
    intent.getStringExtra("SCAN_RESULT_FORMAT");
          Toast.makeText(TestQRCodeActivity.this,
    "Scan Result:" + capturedQrValue, Toast.LENGTH_SHORT)
    .show();
   } else if (resultCode == RESULT_CANCELED) {
    // Handle cancel

   }
  } else {

  }
 }
}

 I am also sharing the screen shot which helps you in
        configuring the build path and zxing as a library  
         

 project.



        


android qr code reader integration
android qr code reader
qr code scanner
zxing qr code scanner
            
   
   May this will Helps you.
   Enjoy Coding…. J
   Cheers…. J

Mukesh Kumar

Hi Guys I am from Delhi working as Web/Mobile Application Developer(Android Developer), also have knowledge of Roboelctric and Mockito ,android test driven development... Blogging has been my passion and I think blogging is one of the powerful medium to share knowledge and ideas....

171 comments:

  1. Thnx!! Mukesh for providing the code.
    I am trying to integrate this and your blog help a lot.

    ReplyDelete
  2. Thnx and welcome.....
    please feel free to ask regarding its integration if you are facing any issue at your end...

    ReplyDelete
  3. pls share layout view of the about code

    ReplyDelete
  4. @Muthu:
    In my blog i am sharing the ful running code, pls go through the downloaded link.

    ReplyDelete
    Replies
    1. Hi Mukesh,
      I dont seem to find the code. Please could you give a link. Thanks.

      Delete
    2. Hi Mukesh,
      I dont seem to find the source on your blog. Please help with link.
      I am new to android and needing help with QR. Thank you.
      Cheers
      Francis

      Delete
  5. Hi,
    Have you knowledge about geo fence concepts in google map in android.if yes means please share your knowledge..

    ReplyDelete
  6. yeah i tried in same last project that time my client was saying astonish condition to using Zxing lib, there is any way feel like own app..
    Thanks

    ReplyDelete
  7. Thanks Imran,

    Yes there is a way..I will help you more if you share your code or view.

    ReplyDelete
  8. Hi Mukesh Yadav,
    First of all thank you for an updated tutorial about ZXing library.
    I downloaded your code, create the file code.jar and add it to the 2 packages I downloaded from you. I changed the Java Compiler to 1.6 to remove all the errors. I created the apk file, installed it and when I submited there is a error and appearded a forced close. Do you know the reason?
    I would like to embedded the ZXing library in my app and I think that it´s done by adding the generated core.jar file

    ReplyDelete
  9. Hey Ivan,

    I am also face this issue when ,I am trying to embedded the zxing library.
    In my case , I am getting class not found error.
    This , happen because , I missed to add core.jar into build path.But after adding it reference into my build path ,Its worked.

    I don't know whats wrong in your case , but if you share your error detail i.e log cat detail , then probably o will solved your problem.

    ReplyDelete
  10. Hey Mukesh,
    I saved code.jar into libs folder from com.google.zxing.client.android.PreferencesActivity and then add it into the build path, create the apk file and it work now!!
    Thank you very much.
    Now I would like to use the String capturedQrValue to do a query to a database (the String is a query to a database), I don´t know if I have to do an intent in the if in onActivityResult method from testQRCodeActivity to call to the new classes
    Thanks a lot Mukesh

    ReplyDelete
  11. Hi Ivan,

    If, I am right ,you need to open a new activity
    on the basis of "String capturedQrValue" ??

    If yes, In my code, I am already fetching the "String capturedQrValue" , in onActivityResult.
    You just put new intent to open new class inside the onActivityResult.Just after where ,I am fetching the "String capturedQrValue" from intent.

    Feel, free to ask ,If I am wrong.

    ReplyDelete
  12. Yuo are right again Mukesh
    I did as you said and it works perfectly
    Thanks a lot

    ReplyDelete
  13. i have imported your project into eclipse gives no errors but when i run and click on submit button the application stops unexpectedly so can u suggest something..

    ReplyDelete
  14. Hello Jayant,
    Will you provide me the log cat error which occurs in your case.
    I thinks you are facing the class not found error and your app is going to be force closed....Right ??

    If this is the error please read the conversation B/W me and Ivan.

    ReplyDelete
  15. Why do you need a function onActivityResult(int requestCode, int resultCode, Intent intent), I ran the your application and it does not show the message from function onActivityResult function such as Toast.makeText (MainActivity.this,
    "Scan Result:" + capturedQrValue, Toast.LENGTH_SHORT).show ()
    ???
    Do you know where the source code is located in the CaptureActivity message that displays the results of the scan. Because that would set the TextView results in TestQRCodeActivity?

    ReplyDelete
  16. FYI,
    If you scan a valid qr code then the scan result will be handle inside the onActivityResult(int requestCode, int resultCode, Intent intent).
    The toast display the qr code value.

    Inside the lib project there is class "CaptureActivity" In which I am putting the value in bundle.

    ReplyDelete
  17. Please could you make a video for your project because i'm working on windows and can't fix some problem, please help

    ReplyDelete
  18. Sure, soon I will upload an video tutorial link of Qr code integration.
    In B/w if you have query|problem regarding the integration of above code please let me konow...what it is ??

    ReplyDelete
  19. can you send this project on email please i need help
    EMail :hussainadse@gmail.com

    ReplyDelete
  20. Hello Hussain,
    With this blog I already provided the full working source code , you just need to download it and import it in your IDE.

    ReplyDelete
  21. Mukesh,

    The link to the source code is not working anymore, can you upload it anywhere or send it to me rvardasca@gmail.com

    ReplyDelete
  22. Hi Mukesh,

    I have been searching internet for zxing integration into an existing android application but I could not find a complete tutorial upto yours. I really appreciate your work, with one word it is fabulous!

    I tried to download the code but the zip file does not exist. Could you check it please.

    ReplyDelete
  23. Same as above!

    The file is not there apparently, would be a massive help if you could resolve this :)!

    Thank you in advance ;)!

    ReplyDelete
  24. Hi Mukesh i am not able to download your application but i follow the step that u have told on this blog but i notice that i Zxing folder there are multiple directory, i already found the core.jar in Zxing/core foolder and implement it bbut i found ClassNotFoundExceeprion pls suggest me where i am wrong...

    ReplyDelete
  25. Hello Haris, In your case I think you are not adding the core.jar library in your application build path... So Its giving you ClassNotFoundExceprion .

    ReplyDelete
  26. i already added it but still getting the same error

    ReplyDelete
  27. Clean your project and try it. I am doing the same and Its working at my end.

    Have you added the core.jar as a library in the zxing project?

    ReplyDelete
  28. Hello Mukesh,

    When i am executing this commanf in order to get core.jar
    c:\ZXing-2.1\zxing-2.1\android\src>ant -f core/build.xml

    i am getting build.xml does not exist

    please suggest me when i am wrong i am very thanskfull to you

    ReplyDelete
  29. Mukesh Now i am able to resolve ClassNotFounfException but application creahes with the following log

    02-12 16:13:09.739: W/ActivityThread(28307): Application com.example.testingqrproject is waiting for the debugger on port 8100...
    02-12 16:13:09.739: I/System.out(28307): Sending WAIT chunk
    02-12 16:13:09.949: I/System.out(28307): Debugger has connected
    02-12 16:13:09.949: I/System.out(28307): waiting for debugger to settle...
    02-12 16:13:10.159: I/System.out(28307): waiting for debugger to settle...
    02-12 16:13:10.359: I/System.out(28307): waiting for debugger to settle...
    02-12 16:13:10.549: I/System.out(28307): waiting for debugger to settle...
    02-12 16:13:10.759: I/System.out(28307): waiting for debugger to settle...
    02-12 16:13:10.959: I/System.out(28307): waiting for debugger to settle...
    02-12 16:13:11.159: I/System.out(28307): debugger has settled (1314)
    02-12 16:13:11.439: I/PlatformSupportManager(28307): Using default implementation class com.google.zxing.client.android.common.executor.DefaultAsyncTaskExecInterface of interface com.google.zxing.client.android.common.executor.AsyncTaskExecInterface
    02-12 16:13:11.519: W/CaptureActivity(28307): android.content.pm.PackageManager$NameNotFoundException: com.google.zxing.client.android
    02-12 16:13:11.519: W/CaptureActivity(28307): at android.app.ContextImpl$ApplicationPackageManager.getPackageInfo(ContextImpl.java:1725)
    02-12 16:13:11.519: W/CaptureActivity(28307): at com.google.zxing.client.android.CaptureActivity.showHelpOnFirstLaunch(CaptureActivity.java:676)
    02-12 16:13:11.519: W/CaptureActivity(28307): at com.google.zxing.client.android.CaptureActivity.onCreate(CaptureActivity.java:153)
    02-12 16:13:11.519: W/CaptureActivity(28307): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    02-12 16:13:11.519: W/CaptureActivity(28307): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
    02-12 16:13:11.519: W/CaptureActivity(28307): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
    02-12 16:13:11.519: W/CaptureActivity(28307): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
    02-12 16:13:11.519: W/CaptureActivity(28307): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
    02-12 16:13:11.519: W/CaptureActivity(28307): at android.os.Handler.dispatchMessage(Handler.java:99)
    02-12 16:13:11.519: W/CaptureActivity(28307): at android.os.Looper.loop(Looper.java:130)
    02-12 16:13:11.519: W/CaptureActivity(28307): at android.app.ActivityThread.main(ActivityThread.java:3687)
    02-12 16:13:11.519: W/CaptureActivity(28307): at java.lang.reflect.Method.invokeNative(Native Method)
    02-12 16:13:11.519: W/CaptureActivity(28307): at java.lang.reflect.Method.invoke(Method.java:507)
    02-12 16:13:11.519: W/CaptureActivity(28307): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
    02-12 16:13:11.519: W/CaptureActivity(28307): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
    02-12 16:13:11.519: W/CaptureActivity(28307): at dalvik.system.NativeStart.main(Native Method)

    Sorry for inconvinience pls help me

    ReplyDelete
  30. Hi Mukesh can you please send me the full source code the QR Code Scanner.zip is not clickable
    My email id:prudhvi.1245@gmail.com

    ReplyDelete
  31. Hi Mukesh can you please send me the full source code the QR Code Scanner.zip cant not downloaded.:(
    My email :evayeeyet@gmail.com

    ReplyDelete
  32. Hello Peter, in your case you are not adding the core.jar in your build path due to this your sec folder showing the lote of error. Add the core.jar in your project build path and clean build your project....Hope it fix.

    ReplyDelete
  33. Hello Mukesh,
    first of all I would like to thank you for the great tutorial. Could you please tell me if the application above is a stand alone app or does it call the barcode scanner found on the phone?
    Hoping to hear from you soon
    thanks :)

    ReplyDelete
  34. Hello Niraj,
    No need of barcode scanner app, this application uses zxing as a library project which open a camera by calling the Intent and scan your qr code.

    ReplyDelete
  35. hi Mukesh.

    Appreciate if you can provide me full source code. I am not able to download it here.

    email: nissathanin@gmail.com

    ReplyDelete
  36. hi Mukesh,

    Great tutorial. I could not find anywhere a simpler and complete tutorial for zxing qr code integration. Thank you.

    Could you please send the complete source to vyshakh.r@gmail.com? thanks in advance

    ReplyDelete
  37. Where is the link for running code

    ReplyDelete
  38. while running the above code these are my exception please help me out

    02-26 20:15:56.140: E/AndroidRuntime(19938): FATAL EXCEPTION: main
    02-26 20:15:56.140: E/AndroidRuntime(19938): java.lang.ExceptionInInitializerError
    02-26 20:15:56.140: E/AndroidRuntime(19938): at java.lang.Class.newInstanceImpl(Native Method)
    02-26 20:15:56.140: E/AndroidRuntime(19938): at java.lang.Class.newInstance(Class.java:1429)
    02-26 20:15:56.140: E/AndroidRuntime(19938): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
    02-26 20:15:56.140: E/AndroidRuntime(19938): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
    02-26 20:15:56.140: E/AndroidRuntime(19938): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
    02-26 20:15:56.140: E/AndroidRuntime(19938): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
    02-26 20:15:56.140: E/AndroidRuntime(19938): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
    02-26 20:15:56.140: E/AndroidRuntime(19938): at android.os.Handler.dispatchMessage(Handler.java:99)
    02-26 20:15:56.140: E/AndroidRuntime(19938): at android.os.Looper.loop(Looper.java:123)
    02-26 20:15:56.140: E/AndroidRuntime(19938): at android.app.ActivityThread.main(ActivityThread.java:4627)
    02-26 20:15:56.140: E/AndroidRuntime(19938): at java.lang.reflect.Method.invokeNative(Native Method)
    02-26 20:15:56.140: E/AndroidRuntime(19938): at java.lang.reflect.Method.invoke(Method.java:521)
    02-26 20:15:56.140: E/AndroidRuntime(19938): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
    02-26 20:15:56.140: E/AndroidRuntime(19938): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
    02-26 20:15:56.140: E/AndroidRuntime(19938): at dalvik.system.NativeStart.main(Native Method)
    02-26 20:15:56.140: E/AndroidRuntime(19938): Caused by: java.lang.NoClassDefFoundError: com.google.zxing.ResultMetadataType
    02-26 20:15:56.140: E/AndroidRuntime(19938): at com.google.zxing.client.android.CaptureActivity.(CaptureActivity.java:101)

    ReplyDelete
  39. Hello charan ,
    You are getting java.lang.NoClassDefFoundError:
    because you are not adding the core.jar library project in your build path.

    Try to add it in your build path and then clean your app and reun it.

    ReplyDelete
  40. thanks mukesh its heal alto to me

    ReplyDelete
  41. Hi Mukesh,

    Thanks for the blog its really great.

    However, I am facing a problem. I don't have any errors and after I click the button the app is crashing.

    Any help?

    ReplyDelete
  42. Hi,

    I think the crash is because of the configuration issue.There are two reason 1. Your application can't find the capture activity class.
    2. You are missing something during configuration of zxing library.
    But until and unless If you not provide me any log cat or error I can't help you more.

    ReplyDelete
  43. Please find below the error any help ?

    02-28 03:09:23.465: W/CaptureActivity(786): android.content.pm.PackageManager$NameNotFoundException: com.google.zxing.client.android
    02-28 03:09:23.465: W/CaptureActivity(786): at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:86)
    02-28 03:09:23.465: W/CaptureActivity(786): at com.google.zxing.client.android.CaptureActivity.showHelpOnFirstLaunch(CaptureActivity.java:676)
    02-28 03:09:23.465: W/CaptureActivity(786): at com.google.zxing.client.android.CaptureActivity.onCreate(CaptureActivity.java:153)
    02-28 03:09:23.465: W/CaptureActivity(786): at android.app.Activity.performCreate(Activity.java:4470)
    02-28 03:09:23.465: W/CaptureActivity(786): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
    02-28 03:09:23.465: W/CaptureActivity(786): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
    02-28 03:09:23.465: W/CaptureActivity(786): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
    02-28 03:09:23.465: W/CaptureActivity(786): at android.app.ActivityThread.access$600(ActivityThread.java:128)
    02-28 03:09:23.465: W/CaptureActivity(786): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
    02-28 03:09:23.465: W/CaptureActivity(786): at android.os.Handler.dispatchMessage(Handler.java:99)
    02-28 03:09:23.465: W/CaptureActivity(786): at android.os.Looper.loop(Looper.java:137)
    02-28 03:09:23.465: W/CaptureActivity(786): at android.app.ActivityThread.main(ActivityThread.java:4517)
    02-28 03:09:23.465: W/CaptureActivity(786): at java.lang.reflect.Method.invokeNative(Native Method)
    02-28 03:09:23.465: W/CaptureActivity(786): at java.lang.reflect.Method.invoke(Method.java:511)
    02-28 03:09:23.465: W/CaptureActivity(786): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
    02-28 03:09:23.465: W/CaptureActivity(786): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
    02-28 03:09:23.465: W/CaptureActivity(786): at dalvik.system.NativeStart.main(Native Method)
    02-28 03:09:23.475: D/AndroidRuntime(786): Shutting down VM
    02-28 03:09:23.475: W/dalvikvm(786): threadid=1: thread exiting with uncaught exception (group=0x40c0aa68)
    02-28 03:09:23.495: E/AndroidRuntime(786): FATAL EXCEPTION: main
    02-28 03:09:23.495: E/AndroidRuntime(786): java.lang.RuntimeException: Unable to resume activity {com.xlabs.qrscan/com.google.zxing.client.android.CaptureActivity}: java.lang.NullPointerException
    02-28 03:09:23.495: E/AndroidRuntime(786): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2458)
    02-28 03:09:23.495: E/AndroidRuntime(786): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2486)
    02-28 03:09:23.495: E/AndroidRuntime(786): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2000)

    ReplyDelete
  44. The rest of the error

    02-28 03:09:23.495: E/AndroidRuntime(786): at android.app.ActivityThread.access$600(ActivityThread.java:128)
    02-28 03:09:23.495: E/AndroidRuntime(786): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
    02-28 03:09:23.495: E/AndroidRuntime(786): at android.os.Handler.dispatchMessage(Handler.java:99)
    02-28 03:09:23.495: E/AndroidRuntime(786): at android.os.Looper.loop(Looper.java:137)
    02-28 03:09:23.495: E/AndroidRuntime(786): at android.app.ActivityThread.main(ActivityThread.java:4517)
    02-28 03:09:23.495: E/AndroidRuntime(786): at java.lang.reflect.Method.invokeNative(Native Method)
    02-28 03:09:23.495: E/AndroidRuntime(786): at java.lang.reflect.Method.invoke(Method.java:511)
    02-28 03:09:23.495: E/AndroidRuntime(786): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
    02-28 03:09:23.495: E/AndroidRuntime(786): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
    02-28 03:09:23.495: E/AndroidRuntime(786): at dalvik.system.NativeStart.main(Native Method)
    02-28 03:09:23.495: E/AndroidRuntime(786): Caused by: java.lang.NullPointerException
    02-28 03:09:23.495: E/AndroidRuntime(786): at com.google.zxing.client.android.CaptureActivity.onResume(CaptureActivity.java:167)
    02-28 03:09:23.495: E/AndroidRuntime(786): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1158)
    02-28 03:09:23.495: E/AndroidRuntime(786): at android.app.Activity.performResume(Activity.java:4544)
    02-28 03:09:23.495: E/AndroidRuntime(786): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2448)
    02-28 03:09:23.495: E/AndroidRuntime(786): ... 12 more
    02-28 03:09:23.525: E/android.os.Debug(376): !@Dumpstate > dumpstate -k -t -n -z -d -o /data/log/dumpstate_app_error

    ReplyDelete
  45. Hi, Your application didn't find the CaptureActivity class. This is a configuration issue please provide the right package name and also rememeber to add zxing lib in your build . Otherwise it give you CaptureActivity class not found error and also package name error under which your CaptureActivity class has been placed.

    ReplyDelete
  46. Vincenzo Dicosola28 February 2013 at 20:11

    hi Mukesh,

    Great tutorial.
    Could you please send the complete source to vzodic@libero.it? thanks in advance

    ReplyDelete
  47. Thanks Mukesh its working now ...
    but I get options once the scanning is done I just want to view the QR code in a text view.

    Once i read the code , in my screen appears 3 options:1) Send via sms , 2)share via e-mail and the last one , 3)search on the web.

    I want the read input go directly to my textview and not sshowing these options i am mentioning now.Could you help?

    ReplyDelete
  48. It seems to me that the function onActivityResult is never accessed.

    ReplyDelete
  49. Hey Thanks,

    You have to fetch this data on your onActivityResult() method and there you can set it to textview.

    ReplyDelete
  50. For getting back to your onActivityResult() method.You have to do 2 things:
    1. Calling the intent as startActivityForResult() as I am doing in above code.

    2. After this , getting the scan result in your extras of onActivityResult() method, you have to add this in the CaptureActivity Class inside the handleDecode() method

    Intent intent = new Intent();
    intent.putExtra("RESULT", resultHandler.getDisplayContents().toString());
    setResult(1,intent);
    CaptureActivity.this.finish();

    This helps you in both calling the onActivity method and also show the QR code on a text view.

    ReplyDelete
  51. Hi Mukesh,

    I got the following Runtime Exception.
    Do you have any idea, whats wrong here?

    FATAL EXCEPTION: main
    java.lang.RuntimeException: Unable to resume activity com.example.firsttrialapp/com.google.zxing.client.android.CaptureActivity}: java.lang.ClassCastException: android.widget.TextView cannot be cast to com.google.zxing.client.android.ViewfinderView
    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2866)
    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2895)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2359)
    at android.app.ActivityThread.access$600(ActivityThread.java:150)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
    ...

    Would be great, if you would have any proposal!

    Thank you!

    ReplyDelete
  52. hi..
    i got following Runtime error after clicking SCAN button..
    and i did all u above suggested solution !!

    Help me :(

    justnitinjadhav@gmail.com


    -----------
    D/szipinf(14119): Initializing inflate state
    D/dalvikvm(14119): GC_EXTERNAL_ALLOC freed 48K, 50% free 2694K/5379K, external 0K/0K, paused 422ms
    D/AndroidRuntime(14119): Shutting down VM
    W/dalvikvm(14119): threadid=1: thread exiting with uncaught exception (group=0x40018560)

    FATAL EXCEPTION: main
    android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.google.zxing.client.android.SCAN (has extras) }

    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1409)
    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
    at android.app.Activity.startActivityForResult(Activity.java:2827)
    at com.example.testbarcode.MainActivity$1.onClick(MainActivity.java:34)
    at android.view.View.performClick(View.java:2501)
    at android.view.View$PerformClick.run(View.java:9107)
    at android.os.Handler.handleCallback(Handler.java:587)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:130)
    at android.app.ActivityThread.main(ActivityThread.java:3835)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
    at dalvik.system.NativeStart.main(Native Method)

    ReplyDelete
  53. Hello Nitin,
    1. I think in your code instead of calling
    Intent intent = new Intent(TestQRCodeActivity.this,
    CaptureActivity.class);
    you are calling this,
    Intent intent = new Intent("com.google.zxing.client.android.SCAN");

    2. Also cross check once again for the activity class declaration in your androidmanifest.xml .

    ReplyDelete
  54. Thanks a lot Mukesh! Great one!

    ReplyDelete
  55. Could you please send the complete source to hed-marlino@hotmail.fr ? thanks in advance

    ReplyDelete
  56. Hello Hédi ,

    I have provided all links and code in my blog please go step by step , I don't think you faced any issue in the integration of QR code.

    If you have any query or problem feel free to ask.

    ReplyDelete
  57. hi mukesh...

    I am not able to download your source code. can you pls mail me the whole code at : kan.amruthanair@gmail.com

    Thanks in advance

    ReplyDelete
  58. hello mukesh,

    i want somethng like this for my application.but i am not able download your source code.Can you please mail me the same at: kan.amruthanair@gmail.com

    Thanks in advance

    ReplyDelete
  59. Hey Hi Amrutha, sorry for late response....
    You can download the code from here and follow
    the steps...
    http://code.google.com/p/zxing/source/browse/trunk

    ReplyDelete
  60. Hi, I added zxing library into my app. There is no error. But when i click scan button(b),

    my app crashed. These are errors;

    FATAL EXCEPTION: main
    java.lang.ExceptionInInitializerError
    at java.lang.Class.newInstanceImpl(Native Method)
    at java.lang.Class.newInstance(Class.java:1409)
    at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
    at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop

    (Looper.java:123)
    at android.app.ActivityThread.main(ActivityThread.java:3683)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
    at dalvik.system.NativeStart.main(Native Method)
    Caused by: java.lang.NoClassDefFoundError: com.google.zxing.ResultMetadataType
    at com.google.zxing.client.android.CaptureActivity.(CaptureActivity.java:101)

    ReplyDelete
  61. Hello Emrah Şentürk,
    You are getting this
    error: java.lang.NoClassDefFoundError

    This happens when youe lib project is not configure correctly ,and your class not find any claas or package i.e com.google.zxing.ResultMetadata in your case.

    Can you share the code on button click...

    ReplyDelete
  62. Can you plz send me the full code

    mr.jabbasi@gmail.com

    ReplyDelete
  63. Hi,

    I changed my code. Now I am using intentintegrator and intentresult. And my code is working. But I must link to barcode scanner app from my web server. How to do it?

    ReplyDelete
  64. Hi Mukesh,

    This tutorial is by far the best among others which i referred on internet which can be easily understood.

    Am facing the same error " com.google.zxing.ResultMetadata" class not found error. I have built the core.jar and included in BiuldPath and imported few classes as well which detected core.jar.

    But why am still receiving the error, any help would be very much appreciated. Could you please mail the project to niteesh.g@gmail.com

    ReplyDelete
  65. Hi Mukesh,

    Could you please email me the complete source code to junal@devdec.com

    Thanks!

    ReplyDelete
  66. Thanks a lot Mukesh!
    Working excelent.

    ReplyDelete
  67. hi mukesh,
    i get this error. what is the solution

    java.lang.NullPointerException

    at com.google.zxing.client.android.ViewfinderView.onDraw(ViewfinderView.java:83)

    ReplyDelete
  68. hi there, i really loved your post here. my name is Salman, and i am an undergraduate currently doing my final year project which deals with designing a qrcode scanner as part of the project. what i intend to have is a scanner that will read a code and only direct you to a link that is preconfigured on the app, and will block redirecting to any other link. i have no knowledge of android development, and i was really hoping you will help me acomplish this. my email is techoctober@gmail.com, anticipating your response thanks.

    ReplyDelete
  69. Hello Salman,

    Just call webview inside onActivityResult() method,
    replace the code where I am showing the toast message with the webview .

    ReplyDelete
  70. can u plz mail me code at suman.sarita08@gmail.com

    thanx

    ReplyDelete
  71. Hello Mukesh,

    I am Nitin Gupta

    Thank you very much your code is successfully integrated in App
    but i am using action bar(Fragments) in my application on that condition scanner is not working on rectangle with red line is coming t is not scanning

    your suggestions are required

    Thank you

    ReplyDelete
  72. Hi Mukesh,
    Thank you so much for this tutorial. At first I wasn't able to get onActivityResult to kick off, but I read through the comments and found your solution. As we are incorporating the core into the project we don't have to worry about the rest of handleDecode since we are returning the result to our activity.

    For others benefit my handleDecode method in CaptureActivity now only contains this and returns to my onActivityResult() method.
    public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) {
    inactivityTimer.onActivity();
    lastResult = rawResult;
    ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler(this, rawResult);

    Intent intent = new Intent();
    intent.putExtra("RESULT", resultHandler.getDisplayContents().toString());
    setResult(1,intent);
    CaptureActivity.this.finish();
    }

    Thanks thanks thanks!

    ReplyDelete
  73. Hello, Nitin Gupta
    I have not run this code with fragment so I am not sure about the problem you are facing.
    But, yes if you provide me the sample code on which you are getting the error then may be I will help you in fixing it.You may share your code on my gamil id: mukesh421985@gmail.com

    ReplyDelete
  74. Mukesh ji,
    what to do with this

    FATAL EXCEPTION: main
    java.lang.RuntimeException: Unable to resume activity com.example.barcodescanningapp/com.google.zxing.client.android.CaptureActivity}: java.lang.ClassCastException: android.widget.TextView cannot be cast to com.google.zxing.client.android.ViewfinderView

    ReplyDelete
  75. hello,
    I think this will happen when you calling onActivityForResult() and get the the result.
    Please check where you setting the data in bundle and returning it to your calling activity.

    ReplyDelete
  76. Mukesh ji,

    Highly appriciate if you can guide us on below issue:


    FATAL EXCEPTION: main
    java.lang.RuntimeException: Unable to resume activity com.example.barcodescanningapp/com.google.zxing.client.android.CaptureActivity}: java.lang.ClassCastException: android.widget.TextView cannot be cast to com.google.zxing.client.android.ViewfinderView

    ReplyDelete
  77. Great tutorial. You made my day...

    ReplyDelete
  78. hey mukesh...this code is giving run time error(unable to startactivity CaptureActivity)...can u pls help me?

    ReplyDelete
  79. Hello KUSHMINDER,
    Have you added the CaptureActivity in Androidmanifest.xml??
    Please provide some more logs so can I help you.

    ReplyDelete
  80. Hello Mukesh,

    I am getting following error:
    CaptureActivity cannot be resolved to a type MainActivity.java


    The import com.google.zxing.client.android cannot be resolved MainActivity.java

    how to solve above error?

    Thank you.
    Pram

    ReplyDelete
  81. Hello,

    It means whne you are calling
    Intent intent = new Intent(TestQRCodeActivity.this,
    CaptureActivity.class);

    Your application not able to find the location of CaptureActivity.class.
    Please check the androidmanifest.xml file and also cross check that core.jar lib is added properly.

    ReplyDelete
  82. I when a create the jar and put on my android project, the eclipse don't found the class in the import com.google.zxing.client.android.CaptureActivity;

    ReplyDelete
  83. Iury Ferreira,

    Please add your jar in your project build path.

    ReplyDelete
  84. Hi Mukesh,
    I followed all the steps without getting errors but when I launch the application, it quits and gives these errors in Console:


    "An established connection was aborted by the software in your host machine
    java.io.IOException: An established connection was aborted by the software in your host machine
    at sun.nio.ch.SocketDispatcher.write0(Native Method)
    at sun.nio.ch.SocketDispatcher.write(Unknown Source)
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(Unknown Source)
    at sun.nio.ch.IOUtil.write(Unknown Source)
    at sun.nio.ch.SocketChannelImpl.write(Unknown Source)
    at com.android.ddmlib.JdwpPacket.writeAndConsume(JdwpPacket.java:213)
    at com.android.ddmlib.Client.sendAndConsume(Client.java:607)
    at com.android.ddmlib.HandleHeap.sendREAQ(HandleHeap.java:348)
    at com.android.ddmlib.Client.requestAllocationStatus(Client.java:453)
    at com.android.ddmlib.DeviceMonitor.createClient(DeviceMonitor.java:835)
    at com.android.ddmlib.DeviceMonitor.openClient(DeviceMonitor.java:803)
    at com.android.ddmlib.DeviceMonitor.processIncomingJdwpData(DeviceMonitor.java:763)
    at com.android.ddmlib.DeviceMonitor.deviceClientMonitorLoop(DeviceMonitor.java:652)
    at com.android.ddmlib.DeviceMonitor.access$100(DeviceMonitor.java:44)
    at com.android.ddmlib.DeviceMonitor$3.run(DeviceMonitor.java:580)"


    What should I do?

    ReplyDelete
  85. hi mukesh. thanks for this tutorial..
    I am an undergraduate student. I got toast on method onActivityResult not show after scanning the QR code, how I can resolve this problem?

    thanks before

    ReplyDelete
  86. Hi Mukesh,

    In the above example I am having trouble in Step 2. Kindly guide me in creating core.jar.

    ReplyDelete
  87. Your blog post was very helpful for my project. thank you.

    ReplyDelete
  88. Hye Mukesh,

    Im just trying the tutorial above but its not working.
    Could you please send me the full source code of the QR Code Scanner.

    Email : zuleffendykamal@gmail.com

    Thx.

    ReplyDelete
  89. hi mukesh i couldnt get core.jar file...can u elobarate in detailed manner..please

    ReplyDelete
  90. Can You please share core.jar.

    ReplyDelete
  91. hi mukesh...

    I am not able to download your source code. can you pls mail me the full code at : 274611049@qq.com

    Thanks in advance

    ReplyDelete
  92. Hi Please can you share your core.jar file?

    As I cant seem to build one with your initial steps and the version from Maven doesnt seem to include the CaptureActivity class.

    Thanks,
    Nazrul
    nazrulamin52@gmail.com

    ReplyDelete
  93. I can't find the download link..
    Can you email the zip file to my email?

    sunny_tan0627@livemail.tw

    :( I tried to do it myself but I failed...
    thank you very much :)

    ReplyDelete
  94. Hi .. i have problem in get core.jar file, i can't able to create that, can u please share your code with core.jar file..



    ReplyDelete
  95. I got some error in Zxing library project.. can u share me the code..

    ReplyDelete
  96. thanks a lot for sharing your knowledge
    but the size of application which only contain the scanner exceeds 2MB is there anyway to reduce this file size?

    Best Regards

    ReplyDelete
  97. Hi,
    can you please send me the complete code.

    email:dhaval.p90@gmail.com

    ReplyDelete
  98. Hi,

    I tried copying core.jar downloaded from Maven website in to my Android App's libs/ folder. I can see this getting included in Java Build Path as well. There is no compilation error around here. However, when I launch my app where I am starting the Scanner activity via Intent, I am still prompted to download Barcode Scanner application. I am looking for a "third-party-application-free" solution where user should not be required to download another application to use my app feature. Just copying core.jar is not helping. Can you please advise here what I am missing out? Thanks!

    ReplyDelete
  99. Hello Mukesh,
    Thanks for your support, but I am stuck on 2nd step because I am not familiar with "apache ant", thats why I can't create core.jar file. Please explain 2nd step in brief.
    I am waiting for your positive response.

    Thanks dude,

    From,
    Shailesh Vishwase

    ReplyDelete
  100. Hi Mukesh I did Same Way but while producing .apk file I am getting error like "[2013-10-02 09:26:44 - QRCODE] D:\CDAC\QR READER\ZXing-2.2\zxing-2.2\android\res\xml\preferences.xml:84: error: Error: No resource found that matches the given name (at 'entries' with value '@array/country_codes').
    [2013-10-02 09:26:44 - QRCODE] D:\CDAC\QR READER\ZXing-2.2\zxing-2.2\android\res\xml\preferences.xml:84: error: Error: No resource found that matches the given name (at 'entryValues' with value '@array/country_codes')."

    ReplyDelete
  101. Hello Mukesh
    Thank you so much for the tutorial.

    I'm experiencing a problem, when I run the build.xml file using command prompt to generate the core.jar file, I do not get the jar file, instead I get another zipped zxing folder with another build.xml file..

    Please help

    ReplyDelete
  102. Thanks so much Adam Bannach!!!! Spent a whole day on this.

    ReplyDelete
  103. Oh and thanks a lot Mukesh too!

    ReplyDelete
  104. Its really ,nice blog.covering all android solution...very thanks to Mukesh...

    ReplyDelete
  105. Hye Mukesh,

    Im just trying the tutorial above but its not working.
    Could you please send me the full source code of the QR Code Scanner.

    Email : vicgordienko@gmail.com

    Thx.

    ReplyDelete
  106. Thank you very much for the code, I want vertical orientation of camera while reading bar-code, can you please help me.

    ReplyDelete
  107. Change the android:screenOrientation="Portrait" in AndroidManifest.xml file.

    ReplyDelete
  108. I did this (android:screenOrientation="Portrait") but it is not properly reading bar-code as it was doing in Landsacpe orientation

    ReplyDelete
  109. Yes, agree this is a small issue I too faced while doing my scanner app.I go through some forum but they too suggest to use "landscape" for better performance.That's why I am using in landscape mode.
    May be in the latest zxing lib code they will be fixed this issue also...not sure.

    ReplyDelete
  110. Ok, But My client is not happy with that so can you suggest any other libraries for reading bar-code

    ReplyDelete
  111. IF u only want to scan bar code then use "BarcodeScanner". The above one is work for both barcode as well as qr code scanner.

    ReplyDelete
  112. Thank you for the help

    ReplyDelete
  113. Hello Mukesh, I'm having some troubles adding the zxing library. The folder Core no longer contains a build.xml, so I've tried downloading a new one from the Zxing website.
    After following the tutorial, Eclipse isn't able to find the package com.google.zxing and therefore the CaptureActivity class.
    Also, in myproject - properties - android - libraries - android dependencies appears a new entry; captureactivity.jar with an error:
    captureactivity.jar - /home/myuser/zxing-read-only/android/bin (missing)
    Any ideas of what could be causing this?

    ReplyDelete
  114. Hello Victor, Please clean your project and then try it.

    ReplyDelete
  115. Seems that the problem was that the core.jar wasn't in my /lib. After I moved it, the code error was gone.
    Now I'm trying to execute the app in the emulator.
    Thank you for your time Mukesh, and for your dedication!

    ReplyDelete
  116. how can i change the orientation in portrait of scanning screen

    ReplyDelete
  117. change the code in manifest file
    android:screenOrientation="landscape" to "portrait"

    ReplyDelete
  118. Hi, Mukesh Yadav,

    Can u send me the source code as I no longer can see the scanner.zip?

    Email: eileenchong001@hotmail.com

    Thanks :D

    ReplyDelete
  119. Hi Mukesh can you please send me the full source code. The QR Code Scanner.zip is not clickable
    My email id: arigela.avinash@gmail.com

    ReplyDelete
  120. Mukesh i am not bale to generate core.jar from ant can u provide me core.jar ,

    my email id is dhiraj.linkites@gmail.com

    ReplyDelete
  121. Hi I'm new to android programming, I want to make an android app which reads a QR code with the phone camera and fetch the data from the QR code on reading it. how do I go forward with it?

    ReplyDelete
  122. Hello Mukesh,
    I've imported core.jar, clean projects, and also set the build path as your suggestions on reply posts above, but i still got this error during compiling my apps on logcat:

    02-02 02:49:59.794: E/AndroidRuntime(556): FATAL EXCEPTION: main
    02-02 02:49:59.794: E/AndroidRuntime(556): java.lang.ExceptionInInitializerError
    02-02 02:49:59.794: E/AndroidRuntime(556): at java.lang.Class.newInstanceImpl(Native Method)
    02-02 02:49:59.794: E/AndroidRuntime(556): at java.lang.Class.newInstance(Class.java:1429)
    02-02 02:49:59.794: E/AndroidRuntime(556): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
    02-02 02:49:59.794: E/AndroidRuntime(556): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
    02-02 02:49:59.794: E/AndroidRuntime(556): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
    02-02 02:49:59.794: E/AndroidRuntime(556): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
    02-02 02:49:59.794: E/AndroidRuntime(556): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
    02-02 02:49:59.794: E/AndroidRuntime(556): at android.os.Handler.dispatchMessage(Handler.java:99)
    02-02 02:49:59.794: E/AndroidRuntime(556): at android.os.Looper.loop(Looper.java:123)
    02-02 02:49:59.794: E/AndroidRuntime(556): at android.app.ActivityThread.main(ActivityThread.java:4627)
    02-02 02:49:59.794: E/AndroidRuntime(556): at java.lang.reflect.Method.invokeNative(Native Method)
    02-02 02:49:59.794: E/AndroidRuntime(556): at java.lang.reflect.Method.invoke(Method.java:521)
    02-02 02:49:59.794: E/AndroidRuntime(556): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
    02-02 02:49:59.794: E/AndroidRuntime(556): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
    02-02 02:49:59.794: E/AndroidRuntime(556): at dalvik.system.NativeStart.main(Native Method)
    02-02 02:49:59.794: E/AndroidRuntime(556): Caused by: java.lang.NoClassDefFoundError: com.google.zxing.ResultMetadataType
    02-02 02:49:59.794: E/AndroidRuntime(556): at com.google.zxing.client.android.CaptureActivity.(CaptureActivity.java:91)
    02-02 02:49:59.794: E/AndroidRuntime(556): ... 15 more

    And while compiling it, on Console window it shows :"CaptureActivity] Could not find CaptureActivity.apk!".
    Could you tell me what is it mean ?

    Really needs help here..
    Thanx a lot b4

    ReplyDelete
  123. Hi..Great Tutorial, but I have a little problem.
    I include the library correctly but I can't manage the result.
    My aim is:
    1) scan the QR-code;
    2) manage the content of the scan without the classic choose ("search via internet", "send via sms", etc).

    I whould scan and manage the result. Can I do this?
    Thanks..

    ReplyDelete
  124. You will need to build the core project into a jar file using apache ant
    (download from here http://ant.apache.org/ivy/download.cgi).
    Using a shell or cmd prompt navigate to the root directory of
    the downloaded zxing src and execute “ant -f core/build.xml” Somebody can explain me this? I am novice. Thank you

    ReplyDelete
  125. Can u send me the source code to my email account??
    Because i cant download ur source code.
    stevechyi@gmail.com
    Thank you

    ReplyDelete
  126. Hi Mukesh,
    fantastic tutorial! Perfectly dsecribed, for mewbees like me as well;-)
    Could you please send the zip file to me as well?
    My mail: fedmom@gmx.de
    Thanks a TON !

    ReplyDelete
  127. qr code scanner must work very fast and get result less then 2sec. if any one have ideas about QRcode reader on java. i need some one help to integration of QRcode reader.

    ReplyDelete
  128. Hey Mukesh,
    I just need QR Scanner so can u please mail me the QR Code Scanner Source code on my mail ID- karishmapkale@gmail.com..??

    ReplyDelete
  129. Hi Mukesh,

    Could you send me the code, please?
    email: reg@wiki-workers.com

    Thanks

    ReplyDelete
  130. Can u send me the source code to my email account??
    Because i cant download ur source code.
    birasanth1101@gmail.com
    Thank you

    ReplyDelete
  131. Hello,

    Can you please email me full source code of your app? I really need it on my project.

    ReplyDelete
  132. Nice tutorial.I am not able to download source code .Please mail me the code for qr scanner.
    manjit5686@gmail.com

    ReplyDelete
  133. Nice tutorial.Please mail me the code for qr scanner .
    manjit5686@gmail.com

    ReplyDelete
  134. Please can you send me too the code at jegathaaa@gmail.com?
    Thank you

    ReplyDelete
  135. Can you send me the source code to my email account. Much Thanks.
    suda51@outlook.com

    ReplyDelete
  136. Hi Mukesh,

    Could you send me the code, please?
    email: anya230294@gmail.com

    Thanks

    ReplyDelete
  137. Hi Mukesh,

    Could you send me the code, please?
    email: nutka98@yandexru
    Thanks

    ReplyDelete
  138. Hi, I don't understand why the same coding is scanning only barcodes for me and not QR codes.

    ReplyDelete
  139. Hi Mukesh! Would you be kind to send me the code for the QR scanner too, please? Sorry for the trouble and thank you for your article!
    email: dimineti_la_oshima@yahoo.com

    ReplyDelete
  140. Can anyone please mail me the code at shrinivas.v.pai@gmail.com it would be great help

    ReplyDelete
  141. i have heard abou Zxing qr code scanner, i am using this java qr code reader right now:
    want to have a change, please email me source code. will test it until i use it.

    ReplyDelete
  142. Hi Mukesh,
    Can u please provide the code for Zxing library in portrait view. Scanning both qr and barcodes i needed. please help me

    ReplyDelete
  143. Hi MuKesh, I am getting this exception. Please have a look.
    java.lang.RuntimeException: Unable to start activity ComponentInfo{tv.saamnang.activity/com.google.zxing.client.android.CaptureActivity}: android.content.res.Resources$NotFoundException: File res/xml/preferences.xml from drawable resource ID #0x7f050000

    ReplyDelete
    Replies
    1. I have the same problem:

      java.lang.RuntimeException: Unable to start activity ComponentInfo{com.testqrcode/com.google.zxing.client.android.CaptureActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x0

      Delete
    2. I am running at my end its working fine, can you please drop me your code so that I debug it and rectify it.

      Delete
  144. Please share your code with me at kmbuco@gmail.com.Regards.

    ReplyDelete
  145. i am using android studio for the integration..but i am not able to integrate can you help me with android studio integration please

    ReplyDelete
  146. Can i have a download link of your code? i tried to follow what you said but i cant import a project from that link in git, my eclipse cant identify android folder as a project, can u please help me? noob here

    ReplyDelete
  147. can you give me download link of your code? i tried to follow your direction but my eclipse cant identify that android folder from git as a project. thanks

    ReplyDelete
  148. @MUKESH YADAV,
    I am trying your steps to do same but while creating jar it shows me error. like

    D:\xxx\ZXING SVN CODE>ant -f core/build.xml
    Buildfile: core\build.xml does not exist!
    Build failed.

    I am completely stuck here please do help.plz plz

    ReplyDelete
  149. Hello Sandeep.
    Download the jar directly from here:
    http://mvnrepository.com/artifact/com.google.zxing/core/2.2

    please let me know if you still facing the issue.

    ReplyDelete
    Replies
    1. @mukesh, no words to thanks u. u saved my job.
      I pleased to have ur reply! now I am trying to make android project from zxing svn as Library to add it as module in my project.
      I am doing this all in Android studio.even I did it but that android project has many classes and it seems some are unused and apk becomes max size. possibly I just want scanning QR functions only. so I appreciate your support to do this. hope u will assist as I have seen lots of thread comments in your blog that shows you always help us.

      Delete
  150. Hi Mukesh,

    When i pass intent to CaptureActivity, always open the back(secondry camera) camera, can you plz tell me how can i open the fron camera in this code.

    plz tell me, i am stuck with this.
    thanks

    ReplyDelete
  151. Hi Mukesh,

    When i pass intent to CaptureActivity, always open the back(secondry camera) camera, can you plz tell me how can i open the fron camera in this code.

    plz tell me, i am stuck with this.
    thanks

    ReplyDelete
  152. Hi Mukesh,

    When i pass intent to CaptureActivity, always open the back(secondry camera) camera, can you plz tell me how can i open the fron camera in this code.

    plz tell me, i am stuck with this.
    thanks

    ReplyDelete
  153. Hi,
    I read the article. found it very helpful. I think it is for eclipse. Can you please share the project for android studio.. i am new to android..

    ReplyDelete
  154. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing. Buzz App

    ReplyDelete
  155. By far the best tutorial out there! Great work!!

    ReplyDelete
  156. hi Mukesh Yadav,
    Thank you for the brilliant work! Could you please send me the code at byronova@gmail.com?

    Many thanks! Byronn.

    PS: Is there a way to adapt this for android studio?

    ReplyDelete

 

Copyright @ 2013 Android Developers Blog.