Android Question error on using mobilevision

Almog

Active Member
Licensed User
hello,

I tried to use MobileVision v1.51 textrecognition (https://www.b4x.com/android/forum/t...ion-barcodescanner-using-google-vision.83089/)
And the app crashed
(line 57: If txtrecognizer.isOperational Then )
(line 58: txtrecognizer.takePicture )
(line 59: End If )


Copying updated assets files (1)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Start Recognize... Recognizer ready = true
Error occurred on line: 58 (Main)
android.os.FileUriExposedException: file:///storage/emulated/0/picture.jpg exposed beyond app through ClipData.Item.getUri()
at android.os.StrictMode.onFileUriExposed(StrictMode.java:1796)
at android.net.Uri.checkFileUriExposed(Uri.java:2346)
at android.content.ClipData.prepareToLeaveProcess(ClipData.java:845)
at android.content.Intent.prepareToLeaveProcess(Intent.java:8941)
at android.content.Intent.prepareToLeaveProcess(Intent.java:8926)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1519)
at android.app.Activity.startActivityForResult(Activity.java:4269)
at android.app.Activity.startActivityForResult(Activity.java:4227)
at anywheresoftware.b4a.BA.startActivityForResult(BA.java:537)
at de.donmanfred.TextRecognizerwrapper.takePicture(TextRecognizerwrapper.java:210)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:780)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:363)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:260)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:5637)
at android.view.View$PerformClick.run(View.java:22433)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)


Does anyone know why is this error occured and how to solve it?

Thanks in advance
 

Semen Matusovskiy

Well-Known Member
Licensed User
Use original project. I am sure you changed targetSDKVersion in manifest (for example, to 26 or 27). And try to test under Android 7+.

Library obviously uses intent similar https://www.b4x.com/android/forum/threads/intent-based-camera.69215/#content
Erel wrote initial code (which we do not see) in 2016. Guess, exactly this code was used in library.
But when Google required SDK 26, Erel corrected a code:
The code was updated. It now creates a file:// uri for Android 6- devices and a file provider uri for Android 7+ devices.

You can't correct library. Ask it's author.
 
Upvote 0
Top