Android Question B4A - OCR Library

asmondien

Member
Licensed User
Longtime User
Hi All,

Hope you ca help -

I have been looking OCR library for small project and found this one : https://www.b4x.com/android/forum/t...th-google-play-services-android-vision.70417/

I'm having issues to get this working, I'm also confused by the part it's saying you need .jar in additional library - yet the example code attached shows it's commented out?

After enabling MultiDex - i was able to install the application, but get the following error & the camera is not working.

B4X:
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/samples/vision/ocrreader/OcrCaptureActivity;
    at com.google.android.gms.samples.vision.ocrreader.MainActivity.onClick(MainActivity.java:67)
    at android.view.View.performClick(View.java:7201)
    at android.view.View.performClickInternal(View.java:7170)
    at android.view.View.access$3500(View.java:806)
    at android.view.View$PerformClick.run(View.java:27582)
    at android.os.Handler.handleCallback(Handler.java:883)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7695)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
Caused by: java.lang.ClassNotFoundException: com.google.android.gms.samples.vision.ocrreader.OcrCaptureActivity
    ... 12 more

Could anyone point me in a direction to get OCR working please? Alternatively help with reading a text from an image.

Thanks
 
Last edited:

asmondien

Member
Licensed User
Longtime User
I can see that most of the results, point to the same library - the question then is - Is it working with the latest version of B4A as they are few years old.

Obviously - I'm not that experienced with B4A and asked for little help and I don't see a point of wasting time try using library that is no longer compatible with the B4A. I fully accept that i'm possibly doing something wrong.

Thanks
 
Upvote 0

cenyu

Active Member
Licensed User
Longtime User
Hello asmondien, can you tell me how solve this error?
B4X:
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/samples/vision/ocrreader/OcrCaptureActivity;
    at com.google.android.gms.samples.vision.ocrreader.MainActivity.onClick(MainActivity.java:67)
    at ......


Caused by: java.lang.ClassNotFoundException: com.google.android.gms.samples.vision.ocrreader.OcrCaptureActivity


I was able to install the application, but get the following error & the camera is not working too.
I also find some examples but the code is not work or is so complex for me...
 
Last edited:
Upvote 0

asmondien

Member
Licensed User
Longtime User
Hello asmondien, can you tell me how solve this error?
B4X:
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/samples/vision/ocrreader/OcrCaptureActivity;
    at com.google.android.gms.samples.vision.ocrreader.MainActivity.onClick(MainActivity.java:67)
    at ......


Caused by: java.lang.ClassNotFoundException: com.google.android.gms.samples.vision.ocrreader.OcrCaptureActivity


I was able to install the application, but get the following error & the camera is not working too.
I also find some examples but the code is not work or is so complex for me...

Hi - After this posting my question and solving this - I have found another project by Johan, : https://www.b4x.com/android/forum/t...e-play-services-android-vision.70417/#content

I used this one as this was letting me to get the scanned text to a textbox and it felt easier to get working.

I have attached my exported example give that a go. You will need to add the library to the additional folder.
 

Attachments

  • myOcr.zip
    65.5 KB · Views: 430
Upvote 0

cenyu

Active Member
Licensed User
Longtime User
The problem still there
B4X:
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/samples/vision/ocrreader/OcrCaptureActivity;
    at com.google.android.gms.samples.vision.ocrreader.MainActivity.onClick(MainActivity.java:67)
    at ......


Caused by: java.lang.ClassNotFoundException: com.google.android.gms.samples.vision.ocrreader.OcrCaptureActivity
 
Upvote 0

asmondien

Member
Licensed User
Longtime User
The problem still there
B4X:
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/samples/vision/ocrreader/OcrCaptureActivity;
    at com.google.android.gms.samples.vision.ocrreader.MainActivity.onClick(MainActivity.java:67)
    at ......


Caused by: java.lang.ClassNotFoundException: com.google.android.gms.samples.vision.ocrreader.OcrCaptureActivity

Hi,

That's the same error - okay.
  1. Can I confirm that you have installed the Google Repository via the SDK?
  2. Then my example had AppCombat3 configured with the theme & design support didn't require configuration on this one (just needed the library enabled) + it already had the files required.
  3. Then in tools - jetifer (android x) - I had to jetify the .jar files (I let some one else answer what that is (jetify), I accidentally stumbled on this on a post & tried it)
When I get home I can post my additional library folder, but first let me know how you get on.
 
Upvote 0

cenyu

Active Member
Licensed User
Longtime User
Asmondien, YOU ARE GENIUS!!!!

Thank you soo much!
Everithing now works...

RESPECT!
 
Last edited:
Upvote 0
Top