diff --git a/.hgignore b/.hgignore index 1b450ef3..f8b90263 100644 --- a/.hgignore +++ b/.hgignore @@ -26,3 +26,11 @@ build xcuserdata contents.xcworkspacedata .DS_Store +android/obj +*.class +*.dex +android/libs +android/examples/*/libs +android/*.zip +android/local.properties +android/examples/*/local.properties diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml new file mode 100644 index 00000000..a6d44d43 --- /dev/null +++ b/android/AndroidManifest.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/android/ChangeLog b/android/ChangeLog new file mode 100644 index 00000000..25ef5c5a --- /dev/null +++ b/android/ChangeLog @@ -0,0 +1,2 @@ +version 0.1: + * Add initial support for Android platform diff --git a/android/README b/android/README new file mode 100644 index 00000000..b8521de2 --- /dev/null +++ b/android/README @@ -0,0 +1,112 @@ +ZBar Android SDK +================ + +ZBar Bar Code Reader is an open source software suite for reading bar +codes from various sources, such as video streams, image files and raw +intensity sensors. It supports EAN-13/UPC-A, UPC-E, EAN-8, Code 128, +Code 93, Code 39, Codabar, Interleaved 2 of 5, QR Code and +DataBar. These are the JNI wrappers for developing the library on +Android platform. + +Check the ZBar home page for the latest release, mailing lists, etc. + http://zbar.sourceforge.net/ + +Copyright and License +--------------------- +Licensed under the GNU Lesser General Public License, version 2.1. +http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt + +Copyright 2008-2012 © Jeff Brown et al + +The Android distribution also includes pre-compiled binaries of +supporting libaries, for which copyright, license and source code +locations are as follows: + * The GNU libiconv character set conversion library + Copyright (C) 1999-2011 Free Software Foundation, Inc. + This distribution includes GNU libiconv version 1.14, licensed under + the LGPL version 2. The source code is available from + http://www.gnu.org/software/libiconv + +See included files COPYING and LICENSE for details. + + +Installation +------------ + +After downloading the ZBar-Android-Lib-.zip file, you need to +unzip the file and add it to your Android project. Unzip the file +using your favorite method (ie: command-line, finder, windows +explorer...) + +Follow one of the two options. +Option 1 - via command line + cd + cp -r ZBar-Android-SDK-/libs . + +Option 2 - via Eclipse + Right click on Android Project + Select "Import" -> "File System" + Select "Browse" (next to "From directory File" and select the + ZBar-Android-SDK-/libs directory and click "Open". + Click the check box next to "libs" and the "Options" "Create top-level folder" + check box (below). + Then click "Finish". + + You should then see a "libs" folder under your project. + +Building +-------- + +Via Eclipse +You have to add the zbar.jar file to your build path + 1) select zbar.jar under libs + 2) right-click, select "Build Path" -> "Add to Build Path" + +Via command-line +You are all set; ant will automatcially find jar files under the "libs" +subdirectory. + +Documentation +------------- + TDB + +Examples +-------- + +You should be able to open and build the examples directly from the +unzipped directory. You will need to run the android tools to setup +the local.properties file which sets sdk.dir. + 1) cd /examples/CameraTest + 2) android update project --path . + 3) ant debug install + +If you have problems with this, please create a new Android project +and copy the necessary files from the examples. + +examples/CameraTest is a simple demonstration of how to integrate the +ZBar image scanner with the camera. + +Manually building ZBar JNI library +---------------------------------- +First download and unzip the iconv library source from + http://www.gnu.org/software/libiconv/ + +Then kick off the build from the ZBar android directory. You will +need to run the android tools to setup the local.properties file which +setups sdk.dir. + + 1) cd /android + 2) android update project --path . + 3) ant -Dndk.dir= -Diconv.src= zbar-all + +This will rebuild all source files, create zbar.jar and +ZBarAndroidSDK.zip file (which bundles the jar and shared +libraries). From here, you can follow the steps for "Integrating ZBar +JNI library in Android project". + +To clean run: + ant -Dndk.dir= zbar-clean + +See build-ndk.xml for additional target options. + + diff --git a/android/ant.properties b/android/ant.properties new file mode 100644 index 00000000..ee52d86d --- /dev/null +++ b/android/ant.properties @@ -0,0 +1,17 @@ +# This file is used to override default values used by the Ant build system. +# +# This file must be checked in Version Control Systems, as it is +# integral to the build system of your project. + +# This file is only used by the Ant script. + +# You can use this to override default values such as +# 'source.dir' for the location of your java source folder and +# 'out.dir' for the location of your output folder. + +# You can also use it define how the release builds are signed by declaring +# the following properties: +# 'key.store' for the location of your keystore and +# 'key.alias' for the name of the key to use. +# The password will be asked during the build when you use the 'release' target. + diff --git a/android/build-ndk.xml b/android/build-ndk.xml new file mode 100644 index 00000000..2328d0f2 --- /dev/null +++ b/android/build-ndk.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/build.xml b/android/build.xml new file mode 100644 index 00000000..e7b93ace --- /dev/null +++ b/android/build.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/examples/CameraTest/AndroidManifest.xml b/android/examples/CameraTest/AndroidManifest.xml new file mode 100644 index 00000000..1e99cbca --- /dev/null +++ b/android/examples/CameraTest/AndroidManifest.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + diff --git a/android/examples/CameraTest/ant.properties b/android/examples/CameraTest/ant.properties new file mode 100644 index 00000000..ee52d86d --- /dev/null +++ b/android/examples/CameraTest/ant.properties @@ -0,0 +1,17 @@ +# This file is used to override default values used by the Ant build system. +# +# This file must be checked in Version Control Systems, as it is +# integral to the build system of your project. + +# This file is only used by the Ant script. + +# You can use this to override default values such as +# 'source.dir' for the location of your java source folder and +# 'out.dir' for the location of your output folder. + +# You can also use it define how the release builds are signed by declaring +# the following properties: +# 'key.store' for the location of your keystore and +# 'key.alias' for the name of the key to use. +# The password will be asked during the build when you use the 'release' target. + diff --git a/android/examples/CameraTest/build.xml b/android/examples/CameraTest/build.xml new file mode 100644 index 00000000..df1f293a --- /dev/null +++ b/android/examples/CameraTest/build.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/examples/CameraTest/proguard.cfg b/android/examples/CameraTest/proguard.cfg new file mode 100644 index 00000000..b1cdf17b --- /dev/null +++ b/android/examples/CameraTest/proguard.cfg @@ -0,0 +1,40 @@ +-optimizationpasses 5 +-dontusemixedcaseclassnames +-dontskipnonpubliclibraryclasses +-dontpreverify +-verbose +-optimizations !code/simplification/arithmetic,!field/*,!class/merging/* + +-keep public class * extends android.app.Activity +-keep public class * extends android.app.Application +-keep public class * extends android.app.Service +-keep public class * extends android.content.BroadcastReceiver +-keep public class * extends android.content.ContentProvider +-keep public class * extends android.app.backup.BackupAgentHelper +-keep public class * extends android.preference.Preference +-keep public class com.android.vending.licensing.ILicensingService + +-keepclasseswithmembernames class * { + native ; +} + +-keepclasseswithmembers class * { + public (android.content.Context, android.util.AttributeSet); +} + +-keepclasseswithmembers class * { + public (android.content.Context, android.util.AttributeSet, int); +} + +-keepclassmembers class * extends android.app.Activity { + public void *(android.view.View); +} + +-keepclassmembers enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} + +-keep class * implements android.os.Parcelable { + public static final android.os.Parcelable$Creator *; +} diff --git a/android/examples/CameraTest/project.properties b/android/examples/CameraTest/project.properties new file mode 100644 index 00000000..8da376af --- /dev/null +++ b/android/examples/CameraTest/project.properties @@ -0,0 +1,11 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system use, +# "ant.properties", and override values to adapt the script to your +# project structure. + +# Project target. +target=android-15 diff --git a/android/examples/CameraTest/res/layout/main.xml b/android/examples/CameraTest/res/layout/main.xml new file mode 100644 index 00000000..f6164f1e --- /dev/null +++ b/android/examples/CameraTest/res/layout/main.xml @@ -0,0 +1,28 @@ + + + + + + + +