0

I created a project with the ZXing source code. That works fine.

After I changed the package name

 com.google.zxing.client.android 

to

 com.google.zxing.client.android.vofox

But it shows error in real device (HTC Wildfire)

It has no error in eclipse emulator. My logcat file shown below.

08-23 17:13:58.899: ERROR/AndroidRuntime(9816): FATAL EXCEPTION: main
08-23 17:13:58.899: ERROR/AndroidRuntime(9816): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.zxing.client.android.vofox/com.google.zxing.client.android.vofox.CaptureActivity}: android.view.InflateException: Binary XML file line #26: Error inflating class com.google.zxing.client.android.ViewfinderView
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2781)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2797)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at android.app.ActivityThread.access$2300(ActivityThread.java:135)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2132)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at android.os.Looper.loop(Looper.java:143)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at android.app.ActivityThread.main(ActivityThread.java:4914)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at java.lang.reflect.Method.invokeNative(Native Method)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at java.lang.reflect.Method.invoke(Method.java:521)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at dalvik.system.NativeStart.main(Native Method)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816): Caused by: android.view.InflateException: Binary XML file line #26: Error inflating class com.google.zxing.client.android.ViewfinderView
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at android.app.Activity.setContentView(Activity.java:1654)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at com.google.zxing.client.android.vofox.CaptureActivity.onCreate(CaptureActivity.java:157)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1065)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2745)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     ... 11 more
08-23 17:13:58.899: ERROR/AndroidRuntime(9816): Caused by: java.lang.ClassNotFoundException: com.google.zxing.client.android.ViewfinderView in loader dalvik.system.PathClassLoader[/data/app/com.google.zxing.client.android.vofox-1.apk]
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at android.view.LayoutInflater.createView(LayoutInflater.java:466)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     ... 20 more
08-23 17:13:59.869: ERROR/libagl(103): uses alphaPlaneWorkaround
08-23 17:13:59.889: ERROR/libagl(103): uses alphaPlaneWorkaround
08-23 17:13:59.919: ERROR/libagl(103): uses alphaPlaneWorkaround
08-23 17:13:59.939: ERROR/libagl(103): uses alphaPlaneWorkaround
Sean Owen
  • 66,182
  • 23
  • 141
  • 173
nikhilkilivayil
  • 233
  • 1
  • 5
  • 13
  • Caused by: android.view.InflateException: Binary XML file line #26: Error inflating class com.google.zxing.client.android.ViewfinderView, Caused by: java.lang.ClassNotFoundException: com.google.zxing.client.android.ViewfinderView in loader dalvik.system.PathClassLoader[/data/app/com.google.zxing.client.android.vofox-1.apk] Check these two lines – Randroid Aug 24 '11 at 06:10
  • I'm a developer of this library. Please don't use a subpackage of our project's package. Use your own package for your own code. It also appears that you are mostly copying our code and renaming it. Please do not do this. It was not open-sourced to be copied and pasted, and we disapprove of this. In fact your problem is that you have not entirely understood the code and what you need to rename. Your manifest file still references the old ViewfinderView class. – Sean Owen May 04 '13 at 17:18

1 Answers1

13

Change com.google.zxing.... to com.yourpackage name under layouts/capture & layouts-ldpi @ line

com.google.zxing.client.android.ViewfinderView

It solves the problem... It did for me!!!

Cheers!!

Neo
  • 139
  • 3
  • 6
    Dude you rock lol I had that same problem. @Sean Owen - I think maybe you should include a new tutorial section on your zxing page on google code explaining exactly how to integrate the parts of the barcode software into your own app. I completely understand the want to protect the integrity of your project but I do see you on lots of forums explaining to people not to do what they want to use your guys project for. It would definitely benefit the opensource community to put a detailed tutorial on there on how to integrate the barcode. – James andresakis Jan 11 '12 at 01:48
  • Well, it's always been there... https://code.google.com/p/zxing/wiki/ScanningViaIntent – Sean Owen Apr 30 '13 at 11:33
  • @Sean Owen lot of people are using your project as a library, I understand this is wrong but see your self. You are a Rockstar in QR & Barcode. I have seen you commenting "Don't clone", which is right and I respect that. Don't you think so It is time to give them your code as a library. Give it a thought. Thanks for awesome project. – AkshayT Nov 21 '13 at 19:15
  • You aren't understanding. The part that is a library is already provided as a library: `core/`. An app is not a library -- but this app makes itself available as much as possible via Android Intent. I am happy for people to do whatever they want with it within the license. But I am not happy for people to violate the law by confusing users, or interfere with our app while doing it. It's nothing to do with just, like, not wanting people to copy or something. – Sean Owen Nov 21 '13 at 22:03