Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zxing at Android: Eclipse

Tags:

android

Here's what I want to do.

I'd like to create a new QR code reader, using Zxing.

What I downloaded.

Eclipse SDK Classic Version: 3.7.0; Android SDK (with SDK Tools rev12, and all SDK Platforms, API's, and samples; ADT Plugin in Eclipse (I can see all the API's targets on a list: 1.5-3.2 & Google API's); Zxing 1.7.

Using. Windows 7 32bits.

What are my environment variables.

ANT_HOME, at (...)\apache-ant-1.8.2
JAVA_HOME, at (...)\jdk1.7.0
PATH, at (...)\jdk1.7.0\bin

What I did.

Extracted Zxing 1.7 into a zxing folder, successfully built core.jar using cmd (typing "ant -f core/build.xml" at (...)\zxing; Created two android virtual machines using SDK Manager (Android 1.5 & Android 2.1); Set up SDK Location in Eclipse properties (C:\PROGRA~1\Android\android-sdk). (Sorry if I'm miss something) Created a new Android Project, selected "Create project from existing source", using folder (...)\zxing\android. And selected Android 2.1-update1 version.

In this project properties, I've added at "Java Build Path" -> "Libraries" -> Add External JARs" the file core.jar, at (...)\zxing\core.

Ultimately, I have the the following src:

`com.google.zxing.client.android
com.google.zxing.client.android.book
com.google.zxing.client.android.camera
com.google.zxing.client.android.encode
com.google.zxing.client.android.history
com.google.zxing.client.android.result
com.google.zxing.client.android.result.supplement
com.google.zxing.client.android.share
com.google.zxing.client.android.wifi`

Only *.android.camera seems to be fully working;

The AndroidManifest.xml has some errors though: at

`<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.google.zxing.client.android"
      android:versionName="3.61 beta 1"
      android:versionCode="71"
      android:installLocation="auto">`

no resource identifier found for attribute 'installLocation' in package 'android'

and at

`<supports-screens android:xlargeScreens="true"
                android:largeScreens="true"
                android:normalScreens="true"
                android:smallScreens="true"
                android:anyDensity="true"/>`

no resource identifier found for attribute 'xlargeScreen' in package 'android'

Therefore, I cannot build the project. What can I do? Seems like I've wrongly installed some of the components (possibily Android SDK). Any hints?

Need some help regarding other stuff.

Ummm, if I manage to compile the project, how can I call the scanner?

`Bitmap bMap = BitmapFactory.decodeStream(new FileInputStream(file));  
 LuminanceSource source = new RGBLuminanceSource(bMap);
 BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(
                          source));
 Reader reader = new MultiFormatReader();

 Result result = reader.decode(bitmap);`

And how can I output the files? For instance, I'd like to process the information contained in the QR code. What are the other types of files that I can output the code?

How can I convert this into a library?

How can I import classes? Do I have to include them on AndroidManifest.xml?

Didn't understand this:

In your app's Eclipse build path add reference of zxing-core project so that it is not compiled by JVM.

I have found other method to output files through Intent. But I couldn't get it to work because I needed to download and install some files. What are they?

like image 530
gcats Avatar asked Nov 04 '22 16:11

gcats


1 Answers

Android 2.1 does not support the xLargeScreens attribute (its 2.2+ I think). See this question for more info.

For the installLocation attribute you must also be 2.2 and above ... see this link:

Beginning with API Level 8 (2.2), you can allow your application to be installed on the external storage (for example, the device's SD card). This is an optional feature you can declare for your application with the android:installLocation manifest attribute. If you do not declare this attribute, your application will be installed on the internal storage only and it cannot be moved to the external storage.

Also ... please split your questions into different posts. You FIRST need to get your project running before you can ask:

"how can I call the scanner?"
"And how can I output the files?"
"What are the other types of files that I can output the code?"
"How can I convert this into a library?"
"How can I import classes?"
"I have found other method to output files through Intent. But I couldnt get it to work because I needed to download and install some files. What are they?"

Google is your friend my friend. Out of all the college classes I have taken, I think Google has taught me the most :).

like image 151
Jack Avatar answered Nov 26 '22 04:11

Jack