3

I am developing app with zxing library. I imported the zxing project into my work place. When i importing there were some problems i faced.

  1. Compile the project by java 1.7. I done it.
  2. CameraConfigurationUtils was missing. I copied from the library source.
  3. Resource id's cannot be used to check in the switch case. I changed it to if else.

But finally there is a broblem in the 1. emailResult.getTos() was not resolved in EmailAddressResultHandler 2. Then i built the project there comes the problem R.java cannot be resolved throughout my application.

What i am doing wrong?

ImMathan
  • 3,911
  • 4
  • 29
  • 45
  • this sound more like a compilation/IDE problem and not a zxing library problem. checkout http://stackoverflow.com/questions/4085959/no-generated-r-java-file-in-my-project – MemLeak Aug 08 '14 at 07:23
  • @MemLeak I double checked no android.R imports. And my project build target with android 4.2.2. And my minsdk version with 15 and targetsdk version with 18. – ImMathan Aug 08 '14 at 07:44
  • i have same problem have you resolved it? – sud Dec 08 '15 at 05:44

4 Answers4

1

I think you used the 3.10 or older pre-built jar, but your ZXing project is from GitHub which should use 3.1.1-snapshot.jar build with maven. The APIs had been modified last month according https://github.com/zxing/zxing/commit/8158984458f6db59b462ef2b4dd270321c66f203

I just build the core-3.1.1-SNAPSHOT and test it, it works. You can get it and replace your core.jar and try it :). I put them on my GitHub. https://github.com/voyagewu/ZXing_library/tree/master/core-3.1.1-SNAPSHOT

VoyageWu
  • 21
  • 5
1

Lots wrong here.

CameraConfigurationUtils is not missing: https://github.com/zxing/zxing/blob/master/android-core/src/main/java/com/google/zxing/client/android/camera/CameraConfigurationUtils.java

EmailAddressResultHandler has those methods: https://github.com/zxing/zxing/blob/master/android/src/com/google/zxing/client/android/result/EmailAddressResultHandler.java I suspect you are adding several versions of the library to your project somehow.

You are trying to use android/ as a library project if you see that error about switch. It is not a library, and is not supposed to be used that way.

R.java is generated by your build. You haven't set up your Android project correctly.

I suggest that if you're struggling with using Maven and Android projects, that you should not be copying project code into your project. I think you are headed towards using the project in a way inconsistent with the license: https://github.com/zxing/zxing/wiki/License-Questions It would be far easier for you to start by integrating by Intent: https://github.com/zxing/zxing/wiki/Scanning-Via-Intent

Sean Owen
  • 66,182
  • 23
  • 141
  • 173
0

Update the pre-built jar library: download recent snapshot/nightly builds from https://oss.sonatype.org/content/repositories/snapshots/com/google/zxing/core/

Andrea Motto
  • 1,540
  • 21
  • 38
0

Simply copy CameraConfigurationUtils from: https://github.com/zxing/zxing/blob/master/android-core/src/main/java/com/google/zxing/client/android/camera/CameraConfigurationUtils.java

and paste file into android project's com.google.zxing.client.android.camera package..

error gone for me.

akash kubavat
  • 847
  • 6
  • 17