Android : Integrate Zxing in android app with maven

on Wednesday, October 29, 2014


i'm developing android apps with maven. Now i want to integrate the zxing qr code scanner in my app without installing the zxing barcode scanner app.


I add in my pom.xml the dependency:



<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>android-integration</artifactId>
<version>3.1.0</version>
</dependency>


and in the AndroidManifest.xml the 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="com.google.zxing.client.android.SCAN" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>


And in a OnClickListener i'm starting the Activity:



Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, QR_CODE_SCANNING);


But this exception occurs:



java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{my.package/com.google.zxing.client.android.CaptureActivity}:
java.lang.ClassNotFoundException: Didn't find class
"com.google.zxing.client.android.CaptureActivity" on path:
DexPathList[[zip file "/data/app/my.package-1.apk"],
nativeLibraryDirectories=[/data/app-lib/my.package-1, /system/lib]]


My target API Level is 17...


Any ideas what i'm doing false?


0 comments:

Post a Comment