简介

ZXing (pronounced "zebra crossing") is an open-source, multi-format 1D/2D barcode image processing library implemented in Java, with ports to other languages. Our focus is on using the built-in camera on mobile phones to scan and decode barcodes on the device, without communicating with a server. However the project can be used to encode and decode barcodes on desktops and servers as well. We currently support these formats:

  • UPC-A and UPC-E
  • EAN-8 and EAN-13
  • Code 39
  • Code 93
  • Code 128
  • ITF
  • Codabar
  • RSS-14 (all variants)
  • RSS Expanded (most variants)
  • QR Code
  • Data Matrix
  • Aztec ('beta' quality)
  • PDF 417 ('alpha' quality)
  • core: The core image decoding library, and test code

  • ZXing源码可以从https://code.google.com/p/zxing/downloads/list下载,这里下载ZXing-2.3.0.zip。解压之后得到的就是ZXing源码,有用的是android文件夹和core文件夹。core文件夹是二维码的核心库,可以编译生成jar供其他工程使用。android文件夹里放的是一个android工程CaptureActivity,使用Eclipse打开之后会发现很多错误,就是因为缺少core编译出来的jar文件。可以直接去http://repo1.maven.org/maven2/com/google/zxing/下载jar包放入CaptureActivity工程中的libs文件夹下, 使得这个工程可以编译运行。也可以自己根据core源码编译出jar。供CaptureActivity使用。

  • 编译core过程

  • 编译core过程如下:我的环境是XP,使用adt bundle
    1、配置ant, adt bundle内含ant,所以不用下载,只要设置下环境变量就行。我是在path里添加 D:\adt-bundle-windows-x86-20130917\adt-bundle-windows-x86-20130917\eclipse\plugins\org.apache.ant_1.8.3.v201301120609\bin  
    2、配置android环境变量,在path中加入D:\adt-bundle-windows-x86-20130917\adt-bundle-windows-x86-20130917\sdk\tools                           
    3、下载maven  http://maven.apache.org/download.cgi,配置环境变量,path中加入D:\apache-maven-3.1.1-bin\apache-maven-3.1.1\bin。使用mvn -version验证是否成功,成功如下图所示。

               

      

  • 4、 从命令行进入到 ZXing-2.3.0 目录下:

      输入如下命令:

      android update project --path android

      成功后就可以看到\ZXing-2.3.0\android目录下新增了一个名为local.properties的文件,里面内容是:sdk.dir=你的Android SDK目录

  • 5、编译jar包

      命令行进入到\core路径下,输入命令:

      mvn -DskipTests -Dgpg.skip=true install

      运行完之后core目录下会生成一个target目录。

      里面就有编译好的各种东西,包括文档、需要的Jar包等(比如我的这个叫core-2.3.0.jar)。


  • 6、把这个jar放入CaptureActivity工程中的libs目录下就可以编译运行了。

  • 参考文献:

  • http://www.cnblogs.com/mengdd/p/3289145.html

  • https://code.google.com/p/zxing/wiki/GettingStarted



GitHub 加速计划 / zx / zxing
12
1
下载
ZXing ("Zebra Crossing") barcode scanning library for Java, Android
最近提交(Master分支:4 个月前 )
50799640 Bumps [org.apache.maven.plugins:maven-release-plugin](https://github.com/apache/maven-release) from 3.1.1 to 3.2.0. - [Release notes](https://github.com/apache/maven-release/releases) - [Commits](https://github.com/apache/maven-release/compare/maven-release-3.1.1...maven-release-3.2.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-release-plugin dependency-version: 3.2.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 1 个月前
132ba33d Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v5...v6) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 1 个月前
Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐