-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started Developing
If you just need a pre-built JAR file, you can always find compiled resources from the Maven release repository, including recent snapshot/nightly builds.
Download the latest distribution, version 2.3.0 or later. Or, retrieve the latest source code from Github.
The code is organized into several subdirectories, corresponding to modules, like core/
and javase/
. Within each Java-based module, there is a pom.xml
file for use with Apache Maven.
A few configuration steps are needed, depending on which modules you want to build. From the directory where you unpacked or checked out the source code:
android update project --path android
or
echo "sdk.dir=/change/this/path/to/android-sdk" > android/local.properties
The Android SDK must be installed of course. Run the tool called android
and ensure that platform support for the latest Android release is installed. At the time of this writing, that's platform level 19 / Android 4.4.
- Build
core/
below, first - Run
ant debug
fromandroid/
to build the Barcode Scanner application asbin/Barcode Scanner-debug.apk
.
From android-integration/
, run mvn -Dgpg.skip=true install
to produce compiled libraries like android-integration-x.y.z.jar
in the target/
directory.
From core/
, run mvn -DskipTests -Dgpg.skip=true install
to product compiled libraries like core-x.y.z.jar
in the target/
directory.
To run tests, first download the test images in core/src/test/resources
. These are available separately. Then run mvn test
.
From javase/
, run mvn -Dgpg.skip=true install
to product compiled libraries like javase-x.y.z.jar
in the target/
directory.
From zxingorg/
, run mvn -Dgpg.skip=true package
to product compiled libraries like w.war
in the target/
directory.
Most components are libraries and are not run directly.
- Build
android/
- Connect your device via USB
- If you already have the standard version of Barcode Scanner installed, uninstall it
- Make sure your device is set to allow apps from untrusted sources
- Run
ant installd
to install the debug build
After building, simply run this class with java
from the top-level directory:
java -cp javase/target/javase-x.y.z.jar:core/target/core-x.y.z.jar com.google.zxing.client.j2se.CommandLineRunner [URL | FILE]
Path syntax is different on Windows. Here and elsewhere you will need to use ';' rather than ':' to separate classpath elements, and likely need to use the '' path separator.
core/
, javase/
, android-integration
and zxingorg
can be used directly in a Maven-based project without any download or installation. Instead, add as dependencies from groupID com.google.zxing
artifactIDs core
, javase
, android-integration
or zxingorg
:
<dependencies>
...
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>