In this text ZXING or ZEBRA CROSSING is the 3rd party library.
Technologies required:1. Android SDK Tools v10
2. Android platform 2.2( v8)
3. Zebra Crossing Library 1.6
4. Ant v1.8
5. Eclipse (optional)
This has been done already for the code checked in Zxing.
From command prompt:
To do so go to the location where <Your Project> apps directory is located and run the following command:
android update project --path ./<Your Project> --library /Zing/android
Please note that if you update the project from command prompt Eclipse will not be able to identify the library project. Therefore for development environment in Eclipse where you need to debug the QrCode you need to manually add the Zxing project in <Your Project>.
Step 1: Import <Your Project> and ZXing projects in your workspace.
Step 2: Right Click on ZXing in project explorer->Properties->Android->Check Is Library(Screen 1)
Step 3: Then,
Right Click on <Your Project> in project explorer->Properties->Android->Click on Add button(screen 2).
Step 5: Click Ok(Screen 4)
This should add a similar tag in build.properties. Additionally eclipse will also update .classpath file and .project file adding some thing like below
<classpathentry kind="src" path="ZXing_src"/>
In the .project file a linkedresouces tag will be created and should have a hardcoded path. To avoid hardcoded path in this file.
Include the core.jar file under libs (<Your Project>) in the build path if it is not already included.
Right Click on <Your Project> in project explorer->Properties->Java Build Path->Source->Select ZXing->Click on Edit(Screen 5).
Select PROJECT_LOC(Screen 7).
Click on Extend(Screen 8) and set the correct directory. This will remove the hard coded path.
Please note that this linking should be done only for development environment. Even if these updated config files of Eclipse are put in subversion, only checking them out will not link the entire code base properly. It has been tried and didn’t work out for Eclipse. This is a limitation of Eclipse IDE.
CaptureActivity? of ZXing we need to add the following in Android manifest file:
<activity android:name= "com.google.zxing.client.android.CaptureActivity"
android:windowSoftInputMode= "stateAlwaysHidden" >
<action android:name= "com.google.zxing.client.android.SCAN" />
<category android:name= "android.intent.category.DEFAULT" />
Additionally add the following permission:
<uses-permission android:name ="android.permission.CAMERA" />
Please make sure that <Your Activity> from component section is present in
Now if the apps is built from command prompt using build.xml or from Eclipse the apps will run fine and Camera will be invoked.
Please note that building the zebra crossing separately is not required for using it in <Your Project>. However, for testing purpose it can be done.
You can check out all the files under Zxing in externs section. Alternatively you can create a folder Zxing and inside it download android directory, core directory, and all the configuration related files.
To build it from command prompt, perform the following steps:
Edit build.properties at the top level of the project, and change the android-home property to point to the SDK install location
Download Proguard, version 4.4 minimum, and install it where you like.
Edit build.properties and set proguard-jar to the full path (including the filename) of the proguard library.
Build core; Note that core must be built without debug symbols to avoid an incompatibility between proguard and the Android tool chain:
ant clean build-no-debug
Please note that the build.xml file provided by ZXing open source will throw some errors as some of the tags used in it are depreciated for later versions of ant, android and proguard.
Copy the core.jar file inside android under a new directory core_jar. This is optional and is done to use the same directory to build the ZXing with <Your Project> from command line as well as eclipse.
First create the core.jar file from command prompt. Place the jar file inside core_jar directory in android. Then import the android project in Eclipse. Remove the “Is Library” tag if it is displayed and trigger the build. This will create the apk file.
Enjoy photos on http://www.flickr.com/photos/mithunkundu/
Become my fan on http://www.facebook.com/#%21/profile.php?id=100000525746657
Follow me on http://www.twitter.com/mithunkundu1983/
Visit my Blogs on http://www.mithunkundu.wordpress.com/
Visit my Blogs on http://www.mithunkundu.blogspot.com/