1

I have integrated awesome zxing barcode project in my own project and I am calling it through intent. I don't want user to install one more app for barcode scanning. Completely copied the source code zxing-2.3.0 into my project and resolved all the build errors. Now that when I am running my app and when it reaches a point where it has to execute barcode scanning app crashes with below errors.

Before posting this question I have researched a lot on this but could not find any solution which could solve my problem. Thank you all in advance.

    12-26 18:49:51.387: E/AndroidRuntime(26353): FATAL EXCEPTION: main
    12-26 18:49:51.387: E/AndroidRuntime(26353): Process: com.arrisi.selfinstall, PID: 26353
    12-26 18:49:51.387: E/AndroidRuntime(26353): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.arrisi.selfinstall/com.google.zxing.client.android.CaptureActivity}: android.view.InflateException: Binary XML file line #110: Error inflating class paths
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2198)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2257)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at android.app.ActivityThread.access$800(ActivityThread.java:139)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at android.os.Handler.dispatchMessage(Handler.java:102)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at android.os.Looper.loop(Looper.java:136)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at android.app.ActivityThread.main(ActivityThread.java:5086)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at java.lang.reflect.Method.invokeNative(Native Method)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at java.lang.reflect.Method.invoke(Method.java:515)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at dalvik.system.NativeStart.main(Native Method)
    12-26 18:49:51.387: E/AndroidRuntime(26353): Caused by: android.view.InflateException: Binary XML file line #110: Error inflating class paths
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:441)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at android.preference.GenericInflater.rInflate(GenericInflater.java:481)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at android.preference.GenericInflater.inflate(GenericInflater.java:326)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at android.preference.GenericInflater.inflate(GenericInflater.java:263)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:272)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:485)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:444)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at com.google.zxing.client.android.CaptureActivity.onCreate(CaptureActivity.java:145)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at android.app.Activity.performCreate(Activity.java:5248)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2162)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    ... 11 more
    12-26 18:49:51.387: E/AndroidRuntime(26353): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.preference.paths" on path: DexPathList[[zip file "/data/app/com.arrisi.selfinstall-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.arrisi.selfinstall-1, /vendor/lib, /system/lib]]
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at android.preference.GenericInflater.createItem(GenericInflater.java:375)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at android.preference.GenericInflater.onCreateItem(GenericInflater.java:417)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:428)
    12-26 18:49:51.387: E/AndroidRuntime(26353):    ... 21 more

below is the code segment where it is crashing once intent is invoked to call zxing code.

    Intent intent = new Intent("com.google.zxing.client.android.SCAN"); 
    intent.putExtra("com.google.zxing.client.android.SCAN.SCAN_MODE", "QR_CODE_MODE"); 
    startActivityForResult(intent, 0);
  • possible duplicate of [Unfortunately MyApp has stopped. How can I solve this?](http://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this) – stkent Jan 02 '15 at 03:13
  • that is not helpful at all, I know how to analyze stack trace but this is something related to integrating zxing into our project. – Gururaj Kheni Jan 02 '15 at 05:37
  • But why not import the android folder as existing android project in eclipse then mark it as a library then add it to your project. I have done like this in one of my previous app. – Sumighosh Charuvil Jan 02 '15 at 05:53

2 Answers2

1

The error message is pretty clear. You referenced a class by the name of android.preference.paths in the layout XML file for com.google.zxing.client.android.CaptureActivity and that class doesn't exist.

GreyBeardedGeek
  • 29,460
  • 2
  • 47
  • 67
  • But I do have that class... What I did is, I had my project into that I copied zxing project code inside src/com/ directory. So, now I have two folders inside com now, one my old arrisi/ and another google/... I have followed this link for integrating zxing in my project http://wahidgazzah.olympe.in/integrating-zxing-in-your-android-app-as-standalone-scanner/ – Gururaj Kheni Dec 26 '14 at 13:54
0

If anytime you don't want user to download barcode reader app from play store while using barcode scanner in your app then easiest and best solution is to build zxing as a library and use that library in your own project. Below is the link, I followed the same and it is working now.

https://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app-natively-using-eclipse/