Ошибка при запуске сканера штрих-кода zxing - PullRequest
0 голосов
/ 03 июля 2018

Я получаю эту ошибку при запуске кода сканера штрих-кода zxing. Это работало ранее, но после того, как я добавил некоторые другие действия (не относящиеся к операции со штрих-кодом), это действие не выполняется.

я получаю следующую ошибку. Любая помощь, почему это терпит неудачу, так как это работало, прежде чем я добавил больше действий? Я могу строить и компилировать без ошибок.

E/AndroidRuntime: FATAL EXCEPTION: main
              Process: nextrackdomain.nextrack, PID: 19246
              java.lang.RuntimeException: Unable to start activity ComponentInfo{nextrackdomain.nextrack/nextrackdomain.nextrack.QrCodeActivity}: android.view.InflateException: Binary XML file line #46: Error inflating class nextrackdomain.nextrack.view.QrCodeFinderView
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2689)
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2754)
                  at android.app.ActivityThread.access$900(ActivityThread.java:177)
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1448)
                  at android.os.Handler.dispatchMessage(Handler.java:102)
                  at android.os.Looper.loop(Looper.java:145)
                  at android.app.ActivityThread.main(ActivityThread.java:5938)
                  at java.lang.reflect.Method.invoke(Native Method)
                  at java.lang.reflect.Method.invoke(Method.java:372)
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1389)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1184)
               Caused by: android.view.InflateException: Binary XML file line #46: Error inflating class nextrackdomain.nextrack.view.QrCodeFinderView
                  at android.view.LayoutInflater.createView(LayoutInflater.java:640)
                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:750)
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:366)
                  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:428)
                  at android.app.Activity.setContentView(Activity.java:2267)
                  at nextrackdomain.nextrack.QrCodeActivity.onCreate(QrCodeActivity.java:59)
                  at android.app.Activity.performCreate(Activity.java:6288)
                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2642)
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2754) 
                  at android.app.ActivityThread.access$900(ActivityThread.java:177) 
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1448) 
                  at android.os.Handler.dispatchMessage(Handler.java:102) 
                  at android.os.Looper.loop(Looper.java:145) 
                  at android.app.ActivityThread.main(ActivityThread.java:5938) 
                  at java.lang.reflect.Method.invoke(Native Method) 
                  at java.lang.reflect.Method.invoke(Method.java:372) 
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1389) 
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1184) 
               Caused by: java.lang.reflect.InvocationTargetException
                  at java.lang.reflect.Constructor.newInstance(Native Method)
                  at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
                  at android.view.LayoutInflater.createView(LayoutInflater.java:614)
                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:750) 
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:813) 
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:511) 
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:415) 
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:366) 
                  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:428) 
                  at android.app.Activity.setContentView(Activity.java:2267) 
                  at nextrackdomain.nextrack.QrCodeActivity.onCreate(QrCodeActivity.java:59) 
                  at android.app.Activity.performCreate(Activity.java:6288) 
                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119) 
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2642) 
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2754) 
                  at android.app.ActivityThread.access$900(ActivityThread.java:177) 
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1448) 
                  at android.os.Handler.dispatchMessage(Handler.java:102) 
                  at android.os.Looper.loop(Looper.java:145) 
                  at android.app.ActivityThread.main(ActivityThread.java:5938) 
                  at java.lang.reflect.Method.invoke(Native Method) 
                  at java.lang.reflect.Method.invoke(Method.java:372) 
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1389) 
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1184) 
               Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
                  at nextrackdomain.nextrack.utils.ScreenUtils.getScreenWidth(ScreenUtils.java:29)
                  at nextrackdomain.nextrack.view.QrCodeFinderView.init(QrCodeFinderView.java:86)
                  at nextrackdomain.nextrack.view.QrCodeFinderView.<init>(QrCodeFinderView.java:72)
                  at nextrackdomain.nextrack.view.QrCodeFinderView.<init>(QrCodeFinderView.java:55)
                  at java.lang.reflect.Constructor.newInstance(Native Method) 
                  at java.lang.reflect.Constructor.newInstance(Constructor.java:288) 
                  at android.view.LayoutInflater.createView(LayoutInflater.java:614) 
                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:750) 
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:813) 
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:511) 
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:415) 
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:366) 
                  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:428) 
                  at android.app.Activity.setContentView(Activity.java:2267) 
                  at nextrackdomain.nextrack.QrCodeActivity.onCreate(QrCodeActivity.java:59) 
                  at android.app.Activity.performCreate(Activity.java:6288) 
                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119) 
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2642) 
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2754) 
                  at android.app.ActivityThread.access$900(ActivityThread.java:177) 
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1448) 
                  at android.os.Handler.dispatchMessage(Handler.java:102) 
                  at android.os.Looper.loop(Looper.java:145) 
                  at android.app.ActivityThread.main(ActivityThread.java:5938) 
                  at java.lang.reflect.Method.invoke(Native Method) 
                  at java.lang.reflect.Method.invoke(Method.java:372) 
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1389) 
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1184) 
...