I have already mentioned some simple applications about implementing bar code recognition on andriod. It is unacceptable to install multiple components when zxing is used in the previous article,
I think everyone has come up with a solution. Oh, actually, I am actually learning something, starting from its most basic stuff-we all know that it is the source code.
OK. If we want to further identify the bar code, we will naturally read the zxing source code. After reading it, you will not just understand the source code,
You will find that you have not only gained this, but also more things. For example, you have learned more about Android development by using another app example.
The official website provides free download of the source code, but the help documentation is not very comprehensive. Recently I have read its source code. It is very helpful to debug and run its source code to understand its structure.
The official website only provides download of source code, and does not provide compiled development packages. That is to say, You need to compile the source code after you compile it yourself.ProgramAn error is returned when importing data to myeclipse.
I may not be able to help new users. Here I will talk about zxing compilation and make the most basic preparations for subsequent development!
Step 1: Prepare the package
Download http://code.google.com/p/zxing/
Compile zxing
Download ant address http://ant.apache.org/
Download proguard address http://proguard.sourceforge.net/index.html#/downloads.html
Unzipping: zxing-1.6
Under the directory structure:
Zxing-1.6
-Android
Android-Integration
Core
Build. Properties
Build. xml
........
Step 2: Configure environment variables.
Open build. Properties
Modify proguard. jar in the Lib folder under proguard downloaded for you to point
Android-Home: Your SDK directory
Proguard-jar = ../proguard4.5.1/lib/proguard. jar is later than 4.4
Android-home = ../Android-SDK-Windows
Configure ant Environment Variables
Ant_home
E: \ mylib \ Java \ ant \ apache-ant-1.8.1
Path
E: \ mylib \ Java \ ant \ apache-ant-1.8.1 \ bin
The ant press enter appears in cmd.
Buildfile: Build. XML does not exist!
Build failed
Performance successful!
Step 3: Start Compilation
CD to the core directory and then Ant!
Build successful
Total time: * Second
Indicates successful compilation!
Then compile android
CD ../android
Ant
Okay! With the core package, we can import the package to the project. If so, no error is reported! It can also be run directly!
Zxingtestactivity is an example of zxing. This is a good help for zxing learning! Before running this example, you must first install barcodescanner3.5.apk.
The android directory is the source code of a group of barcodescanner3.5.apk files that must be installed during the debugging. Well, I guess everyone knows, right,
If you do not want to install it, You can directly modify the source code and compile it.
I hope that my articles will help you in some ways. In the end, I can only read my own code!
You must be smarter than me. You will soon understand the source code and use it quickly. If you have any questions, I hope you can study it together and make continuous progress!
I want to write some examples of zxing-based bar code recognition applications! If you are interested, I will share it with you! Now, I will write it here today!
Additional compilation instructions:
For more information, see:
# Download and install the latest public Android SDK.
# 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:
CD Core
Ant clean build-no-Debug
# Build Android:
CD ../android
Ant
In addition, I uploaded and compiled my jar package for you to download:
Http://files.cnblogs.com/tankaixiong/zxing%e6%a0%b8%e5%bf%83%e5%8c%85.rar