nisrulz / qreader

:white_square_button: [Android Library] Read QR codes using google's mobile vision api, but without the hassle
http://nisrulz.github.io/qreader
Apache License 2.0
371 stars 108 forks source link

Failed resolution of: Lcom/google/android/gms/internal/zzdcc; #48

Closed babulpatel1309 closed 3 years ago

babulpatel1309 commented 6 years ago

Here is my function :

 private void initQRReader() {

        try {
            if (qrEader != null && qrEader.isCameraRunning()) {
                qrEader.releaseAndCleanup();
            }

            qrEader = new QREader.Builder(context, binding.cameraView, new QRDataListener() {
                @Override
                public void onDetected(final String data) {

                   //My work
                }
            }).facing(QREader.BACK_CAM)
                    .enableAutofocus(true)
                    .height(binding.cameraView.getHeight())
                    .width(binding.cameraView.getWidth())
                    .build();
        } catch (Exception e) {
            e.printStackTrace();
            toast("Sorry scanner is not supported on this device.");
        }
    }

And also followed onResume and onPause methods to make this thing work. Please help me.

Facing this issue. Suddenly it started with version 2.1.2 now its even not working with 2.1.1

01-03 10:22:22.227 6808-6808/com.Invoice.maker E/AndroidRuntime: FATAL EXCEPTION: main Process: com.Invoice.maker, PID: 6808 java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/internal/zzdcc; at com.google.android.gms.vision.barcode.BarcodeDetector$Builder.(Unknown Source:5) at github.nisrulz.qreader.BarcodeDetectorHolder.getBarcodeDetector(BarcodeDetectorHolder.java:38) at github.nisrulz.qreader.QREader.(QREader.java:104) at github.nisrulz.qreader.QREader.(QREader.java:40) at github.nisrulz.qreader.QREader$Builder.build(QREader.java:357) at com.invoiceapp.Main.CodeScannerActivity.initQRReader(CodeScannerActivity.java:109) at com.invoiceapp.Main.CodeScannerActivity.access$000(CodeScannerActivity.java:22) at com.invoiceapp.Main.CodeScannerActivity$1.onGranted(CodeScannerActivity.java:40) at com.invoiceapp.Main.BaseActivity$27.onPermissionsGranted(BaseActivity.java:3636) at com.kishan.askpermission.AskPermissionImp.requestAppPermissions(AskPermissionImp.java:71) at com.kishan.askpermission.ShadowFragment.onCreate(ShadowFragment.java:41) at android.app.Fragment.performCreate(Fragment.java:2489) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1237) at android.app.FragmentManagerImpl.addAddedFragments(FragmentManager.java:2407) at android.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2186) at android.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2142) at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2043) at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3032) at android.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2979) at android.app.FragmentController.dispatchActivityCreated(FragmentController.java:178) at android.app.Activity.performCreate(Activity.java:7005) at android.app.Activity.performCreate(Activity.java:6990) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) Caused by: java.lang.ClassNotFoundException: com.google.android.gms.internal.zzdcc at java.lang.VMClassLoader.findLoadedClass(Native Method) at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738) at java.lang.ClassLoader.loadClass(ClassLoader.java:363) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at com.google.android.gms.vision.barcode.BarcodeDetector$Builder.(Unknown Source:5)  at github.nisrulz.qreader.BarcodeDetectorHolder.getBarcodeDetector(BarcodeDetectorHolder.java:38)  at github.nisrulz.qreader.QREader.(QREader.java:104)  at github.nisrulz.qreader.QREader.(QREader.java:40)  at github.nisrulz.qreader.QREader$Builder.build(QREader.java:357)  at com.invoiceapp.Main.CodeScannerActivity.initQRReader(CodeScannerActivity.java:109)  at com.invoiceapp.Main.CodeScannerActivity.access$000(CodeScannerActivity.java:22)  at com.invoiceapp.Main.CodeScannerActivity$1.onGranted(CodeScannerActivity.java:40)  at com.invoiceapp.Main.BaseActivity$27.onPermissionsGranted(BaseActivity.java:3636)  at com.kishan.askpermission.AskPermissionImp.requestAppPermissions(AskPermissionImp.java:71)  at com.kishan.askpermission.ShadowFragment.onCreate(ShadowFragment.java:41)  at android.app.Fragment.performCreate(Fragment.java:2489)  at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1237)  at android.app.FragmentManagerImpl.addAddedFragments(FragmentManager.java:2407)  at android.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2186)  at android.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2142)  at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2043)  at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3032)  at android.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2979)  at android.app.FragmentController.dispatchActivityCreated(FragmentController.java:178)  at android.app.Activity.performCreate(Activity.java:7005)  at android.app.Activity.performCreate(Activity.java:6990)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)  at android.app.ActivityThread.-wrap11(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loop(Looper.java:164)  at android.app.ActivityThread.main(ActivityThread.java:6494)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)  Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/internal/zzbck; at com.google.android.gms.vision.barcode.BarcodeDetector$Builder.(Unknown Source:5)  at github.nisrulz.qreader.BarcodeDetectorHolder.getBarcodeDetector(BarcodeDetectorHolder.java:38)  at github.nisrulz.qreader.QREader.(QREader.java:104)  at github.nisrulz.qreader.QREader.(QREader.java:40)  at github.nisrulz.qreader.QREader$Builder.build(QREader.java:357)  at com.invoiceapp.Main.CodeScannerActivity.initQRReader(CodeScannerActivity.java:109)  at com.invoiceapp.Main.CodeScannerActivity.access$000(CodeScannerActivity.java:22)  at com.invoiceapp.Main.CodeScannerActivity$1.onGranted(CodeScannerActivity.java:40)  at com.invoiceapp.Main.BaseActivity$27.onPermissionsGranted(BaseActivity.java:3636)  at com.kishan.askpermission.AskPermissionImp.requestAppPermissions(AskPermissionImp.java:71)  at com.kishan.askpermission.ShadowFragment.onCreate(ShadowFragment.java:41)  at android.app.Fragment.performCreate(Fragment.java:2489)  at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1237)  at android.app.FragmentManagerImpl.addAddedFragments(FragmentManager.java:2407)  at android.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2186)  at android.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2142)  at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2043)  at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3032)  at android.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2979)  at android.app.FragmentController.dispatchActivityCreated(FragmentController.java:178)  at android.app.Activity.performCreate(Activity.java:7005)  at android.app.Activity.performCreate(Activity.java:6990)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)  at android.app.ActivityThread.-wrap11(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loop(Looper.java:164)  at android.app.ActivityThread.main(ActivityThread.java:6494)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)  Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.internal.zzbck" on path: DexPathList[[zip file "/data/app/com.Invoice.maker-g0I69RbPTxHTnyU9ounT5A==/base.apk"],nativeLibraryDirectories=[/data/app/com.Invoice.maker-g0I69RbPTxHTnyU9ounT5A==/lib/x86, /data/app/com.Invoice.maker-g0I69RbPTxHTnyU9ounT5A==/base.apk!/lib/x86, /system/lib, /vendor/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at com.google.android.gms.vision.barcode.BarcodeDetector$Builder.(Unknown Source:5)  at github.nisrulz.qreader.BarcodeDetectorHolder.getBarcodeDetector(BarcodeDetectorHolder.java:38)  at github.nisrulz.qreader.QREader.(QREader.java:104)  at github.nisrulz.qreader.QREader.(QREader.java:40)  at github.nisrulz.qreader.QREader$Builder.build(QREader.java:357)  at com.invoiceapp.Main.CodeScannerActivity.initQRReader(CodeScannerActivity.java:109)  at com.invoiceapp.Main.CodeScannerActivity.access$000(CodeScannerActivity.java:22)  at com.invoiceapp.Main.CodeScannerActivity$1.onGranted(CodeScannerActivity.java:40)  at com.invoiceapp.Main.BaseActivity$27.onPermissionsGranted(BaseActivity.java:3636)  at com.kishan.askpermission.AskPermissionImp.requestAppPermissions(AskPermissionImp.java:71)  at com.kishan.askpermission.ShadowFragment.onCreate(ShadowFragment.java:41)  at android.app.Fragment.performCreate(Fragment.java:2489)  at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1237)  at android.app.FragmentManagerImpl.addAddedFragments(FragmentManager.java:2407)  at android.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2186)  at android.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2142)  at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2043)  at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3032)  at android.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2979)  at android.app.FragmentController.dispatchActivityCreated(FragmentController.java:178)  at android.app.Activity.performCreate(Activity.java:7005)  at android.app.Activity.performCreate(Activity.java:6990)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)  at android.app.ActivityThread.-wrap11(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loop(Looper.java:164)  at android.app.ActivityThread.main(ActivityThread.java:6494)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 

nisrulz commented 6 years ago

@babulpatel1309 let me check and get back to you.

arpitsingh21 commented 6 years ago

same issue

amirc901 commented 6 years ago

same issue here seems that changing my project firebase version to 11.4.2 resolves problem

DeveloperDen commented 6 years ago

same issue here

giangriver commented 6 years ago

I meet the same issue and resolved it by adding "com.google.android.gms:play-services-vision" implementation 'com.google.android.gms:play-services-vision:15.0.2'

johan-steffens commented 6 years ago

@river9 Thank you. Had to do a clean + build, but it fixed it for me too.

sandeepkumar5 commented 5 years ago

I have faced same issue and resolved it by adding implementation 'com.google.android.gms:play-services-vision:15.0.2'

grantperry commented 5 years ago

Now resolved using: implementation: 'com.google.firebase:firebase-ml-vision:21.0.0'

josepereira1 commented 4 years ago

I have the same issue, and resolved with: implementation 'com.google.firebase:firebase-ml-vision:21.0.0'

samsax commented 3 years ago

I solved it adding: implementation 'com.google.android.gms:play-services-vision:20.1.3'

nisrulz commented 3 years ago

I think it is safe to say that this library is mostly out of date. I am open to someone making a PR contribution, but the way people are finding ways to bypass this issue seems like it will cause more issues. The dependencies have evolved and the library doesn't know about that. It used to work with a certain version of google vision.

Just putting this out that you all understand the risks. I can't make timeline promises but I am planning on migrating to mavenCentral because of Jcenter is going away.. so this lib would also see an update. Until then these hacks above are risky stuff.

kasfulanwar commented 3 years ago

Same problem

snowaye commented 3 years ago

Same here! My client said this library is best qr scanner when I gave them a try-out sample with six different qr scanner libraries :expressionless:

Anyway thank you all above commented for giving me the idea to do that trick. That works for me by adding implementation 'com.google.android.gms:play-services-vision:20.1.3'

nisrulz commented 3 years ago

I am picking this up in coming weeks. I have freed up my time to come back to open source work again. Lets see when I can make a proper release that includes fixes for this long standing issue and mavenCentral.

nisrulz commented 3 years ago

The code in develop branch has been updated and it included upgrade to AndroidX and Firebase Vision libraries.

I am going to close this issue for now. When a new release goes out and the issue still persists then please open a new issue. That way we can track it properly with the updated code.