qq_32411217
qq_32411217
2018-06-04 03:56

关于安卓zxing项目的使用问题

40
  • android

用了两份zxing模块,一份保留了完整功能作为依赖库,一份是精简版放在主程序模块中,我的构想是主界面有扫码识别、历史记录、分享等功能,还有个跳转的次界面的功能是个数据库的增删查改,使用精简版zxing用于扫码直接输出结果到一个EditView框中方便操作。
代码基本实现,build没有问题,但是run就出问题了,虚拟安卓设备一直显示xx已停止运行,run的错误如下:

 E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.example.zxingdemo, PID: 1969
                  java.lang.RuntimeException: Unable to resume activity {com.example.zxingdemo/com.google.zxing.client.android.CaptureActivity}: java.lang.ClassCastException: com.karics.library.zxing.view.ViewfinderView cannot be cast to com.google.zxing.client.android.ViewfinderView
                      at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3645)
                      at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3685)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2898)
                      at android.app.ActivityThread.-wrap11(Unknown Source:0)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
                      at android.os.Handler.dispatchMessage(Handler.java:105)
                      at android.os.Looper.loop(Looper.java:164)
                      at android.app.ActivityThread.main(ActivityThread.java:6541)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
                   Caused by: java.lang.ClassCastException: com.karics.library.zxing.view.ViewfinderView cannot be cast to com.google.zxing.client.android.ViewfinderView
                      at com.google.zxing.client.android.CaptureActivity.onResume(CaptureActivity.java:162)
                      at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1354)
                      at android.app.Activity.performResume(Activity.java:7079)
                      at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3620)
                      at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3685) 
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2898) 
                      at android.app.ActivityThread.-wrap11(Unknown Source:0) 
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) 
                      at android.os.Handler.dispatchMessage(Handler.java:105) 
                      at android.os.Looper.loop(Looper.java:164) 
                      at android.app.ActivityThread.main(ActivityThread.java:6541) 
                      at java.lang.reflect.Method.invoke(Native Method) 
                      at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 
I/InactivityTimer: Finishing activity due to inactivity
Application terminated.

萌新求解,,,

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

3条回答