I try to integrate the zxing-Library into an Android app, so the user does not have to have zxing installed.
What I did:
creating an own build.xml (in core/... was none):
<?xml version="1.0" encoding="utf-8" ?>
<project name="core" default="jar" basedir=".">
<target name="compile" description="Compile source">
<mkdir dir="bin" />
<javac srcdir="src" includes="**" destdir="bin"/>
<copy todir="bin">
<fileset dir="src" />
</copy>
</target>
<target name="jar" description="Package into JAR" depends="compile">
<jar destfile="core.jar" basedir="bin" compress="true" />
</target>
</project>
creating an core.jar with ant -f core/build.xml
What I also tried:
And this is the upper part of the appearing errors
02-21 11:34:55.055: E/AndroidRuntime(8797): FATAL EXCEPTION: main
02-21 11:34:55.055: E/AndroidRuntime(8797): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.hit.scantohit/com.google.zxing.client.android.CaptureActivity}: java.lang.ClassNotFoundException: com.google.zxing.client.android.CaptureActivity
the Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hit.scantohit"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.CAMERA"/>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="14" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.hit.scantohit.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="scanclinet"
android:scheme="hitscheme" />
<!-- myscheme://myhost ==> hitscheme://scanclinet -->
</intent-filter>
</activity>
<activity
android:name="com.google.zxing.client.android.CaptureActivity"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:windowSoftInputMode="stateAlwaysHidden" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="com.google.zxing.client.android.SCAN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
the layout xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<Button
android:id="@+id/btn_start_hit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/btn_start_scan"
android:layout_alignBottom="@+id/btn_start_scan"
android:layout_marginLeft="63dp"
android:layout_toRightOf="@+id/btn_start_scan"
android:text="HIT" />
<Button
android:id="@+id/btn_start_scan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="42dp"
android:layout_marginLeft="83dp"
android:text="SCAN" />
</RelativeLayout>
Does anyone knows any help?
I could solve the problem by using Zxing 2.1 instead of 2.2. like descriped here:
http://khurramitdeveloper.blogspot.ch/p/android-barcode-scan-using-zxing-library.html
And here you can get the Zxing 2.1
https://code.google.com/p/zxing/downloads/detail?name=ZXing-2.1.zip