Zbar Android SDK source code compilation

Source: Internet
Author: User

Zbar, parsing bar code and two-dimensional code of another weapon, Zbar code is written in C language, if you want to use the Zbar class library under Android, you need to use the NDK to compile zbar. So load use, Zbar compiled Android SDK can be downloaded on the official website, address : http://zbar.sourceforge.net/

The following explains how we compile Zbar's Android SDK, my development environment for Win7 64+ant 1.9.5+cygwin64+android-ndk-r9d-windows-x86_64

1. Preparatory work

1.1 Download ANT, configure environment variables, and add%ant_home%\bin in Path path

Enter the ant-v command at the command line with the following message indicating that the ant installation configuration was successful

1.2 Download Install Cygwin 64-bit version

1.3 Download Install NDK 64-bit version, extract to the specified directory, such as D:\Software\android-ndk-r9d

1.4 Download the Zbar code from Https://github.com/zbar/zbar, unzip the following directory as follows:

2. Compiling the SDK

2.1 compiling Libiconv

Download Libiconv source libiconv-1.14.tar.gz from Http://www.gnu.org/software/libiconv website, extract to the specified directory, such as C:\libiconv-1.14

Open Cygwin, switch to the C:\libiconv-1.14 directory, and enter the following command: ./configure--build=x86_64-pc-linux-gnu--host=arm-linux-eabi


Modify Libcharset/config.h file To change # define Have_langinfo_codeset 1 to # define Have_langinfo_codeset 0

Modify the file Libcharset/lib/localcharset.c file in function get_charset_aliases (void), search: int c; Place the variable definition at the beginning of the function.

2.2 Compiling SDK Packages

Open the command line, switch to Zbar's Android directory, and enter the command Android update Project--path.

If an error occurs, first enter the command Android list target to list the current target, and then in the command Android Update Project--path. After adding the corresponding target, as follows:

Open the Build-ndk.xml file, modify the Ndk-build to Ndk-build.cmd, and add source= "1.6" target= "1.6" in the Javac node

Then execute the following command on the command line ant-dndk.dir=d:\software\android-ndk-r9d-diconv.src=c:\libiconv-1.14 Zbar-all, where D:\Software\ android-ndk-r9d

For the NDK path, the C:\libiconv-1.14 is the source file path for Libiconv, which indicates that the compilation was successful if the following information appears

At this point we can see the newly compiled files in the Android\libs directory

Zbar Android SDK source code compilation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.