zsajjad / react-native-text-detector

Text Detector from image for react native using firebase MLKit on android and Tesseract on iOS
MIT License
221 stars 60 forks source link

FirebaseMLHandler Error When Run #7

Open yoesak opened 5 years ago

yoesak commented 5 years ago

Hi,

Could you please inform me how to solve this issue, I don't have build error, but the exception raised when run

E/AndroidRuntime: FATAL EXCEPTION: FirebaseMLHandler Process: com.testcamera, PID: 6933 java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/internal/zzbgl; at com.google.android.gms.internal.firebase_ml.zzjz.zzga(Unknown Source:7) at com.google.android.gms.internal.firebase_ml.zzij.zzgd(Unknown Source:7) at com.google.android.gms.internal.firebase_ml.zzij.call(Unknown Source:23) at com.google.android.gms.internal.firebase_ml.zzhx.zza(Unknown Source:29) at com.google.android.gms.internal.firebase_ml.zzhy.run(Unknown Source:2) at android.os.Handler.handleCallback(Handler.java:789) at android.os.Handler.dispatchMessage(Handler.java:98) at com.google.android.gms.internal.firebase_ml.zze.dispatchMessage(Unknown Source:5) at android.os.Looper.loop(Looper.java:164) at android.os.HandlerThread.run(HandlerThread.java:65) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.internal.zzbgl" on path: DexPathList[[zip file "/data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/base.apk", zip file "/data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/split_lib_dependencies_apk.apk", zip file "/data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/split_lib_slice_0_apk.apk", zip file "/data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/split_lib_slice_1_apk.apk", zip file "/data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/split_lib_slice_2_apk.apk", zip file "/data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/split_lib_slice_3_apk.apk", zip file "/data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/split_lib_slice_4_apk.apk", zip file "/data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/split_lib_slice_5_apk.apk", zip file "/data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/split_lib_slice_6_apk.apk", zip file "/data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/split_lib_slice_7_apk.apk", zip file "/data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/split_lib_slice_8_apk.apk", zip file "/data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/lib/arm, /data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/base.apk!/lib/armeabi-v7a, /data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/split_lib_dependencies_apk.apk!/lib/armeabi-v7a, /data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/split_lib_slice_0_apk.apk!/lib/armeabi-v7a, /data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/split_lib_slice_1_apk.apk!/lib/armeabi-v7a, /data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/split_lib_slice_2_apk.apk!/lib/armeabi-v7a, /data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/split_lib_slice_3_apk.apk!/lib/armeabi-v7a, /data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/split_lib_slice_4_apk.apk!/lib/armeabi-v7a, /data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/split_lib_slice_5_apk.apk!/lib/armeabi-v7a, /data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/split_lib_slice_6_apk.apk!/lib/armeabi-v7a, /data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/split_lib_slice_7_apk.apk!/lib/armeabi-v7a, /data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/split_lib_slice_8_apk.apk!/lib/armeabi-v7a, /data/app/com.testcamera-ohnPqi-wOoaVACf52FQ-KA==/split_lib_slice_9_apk.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312)

yoesak commented 5 years ago

Finally I found the solution

  1. make sure your dependencies in android/app/build.gradle: dependecies { //....

    implementation 'com.google.firebase:firebase-core:+'

    implementation 'com.google.firebase:firebase-ml-vision:+' //...... }

  2. add following to android/build.gradle:

allprojects { repositories { //start here configurations.all { resolutionStrategy.eachDependency { DependencyResolveDetails details -> def requested = details.requested if (requested.group == 'com.google.android.gms') { details.useVersion '+' } if (requested.group == 'com.google.firebase') { details.useVersion '+' } } } //end jcenter() maven { url "https://maven.google.com" } } }