Android Question B4A, inline java, android 7

drgottjr

Expert
Licensed User
Longtime User
i wanted to ask for some help regarding error handling for inline java with b4a. the call which causes the error (actually, it's a crash) concerns declaring an instance of the so called TessBaseAPI in tesseract. the call works fine on all my test devices running os 4.x.x through 5.1, but deploying to my nexus 5 with android 7.1 causes the app to crash with no logging that i can see or know how to extract.

i've trapped for a null value on return from the call (but it doesn't return), and i've tried try/catch
hoping for logging the exception. again, the function never returns. i would try "try throws exception", but i don't know what the exception is, as the crash shows nothing more than "app has stopped. start again?"

i realize tesseract is beyond the scope of the forum, but for the moment at least i would just like
to be able to trap for the crash. if trappable it is. is there some system log output generated automatically by the os and which i could see from b4A? i use BA.Log() after the call returns, but the crash occurs before any return.

the call takes no parameters to fiddle with: TessBaseAPI api = new TessBaseAPI();
and, as i've indicated, the call (indeed the entire test) works fine except on android 7.

the test itself is found at https://www.b4x.com/android/forum/attachments/tesstest-zip.36963/
it was part of a lengthy thread regarding tesseract. while the test is small, the required
ancillary files are not, as you can surmise from the attached snippet:

i realize any one of those additional files could be at the root of the crash, but i'm hoping that if i can
successfully trap for the exception and display it, at least i would have an idea about what i was up against. thanks for any help.

go
 

Attachments

  • snip.txt
    296 bytes · Views: 245

drgottjr

Expert
Licensed User
Longtime User
based on all the imports in my inline code, am i doing precisely what android 7 doesn't want we to do?

https://developer.android.com/about/versions/nougat/android-7.0-changes.html

NDK Apps Linking to Platform Libraries
Starting in Android 7.0, the system prevents apps from dynamically linking against non-NDK libraries, which may cause your app to crash. This change in behavior aims to create a consistent app experience across platform updates and different devices. Even though your code might not be linking against private libraries, it's possible that a third-party static library in your app could be doing so. Therefore, all developers should check to make sure that their apps do not crash on devices running Android 7.0. If your app uses native code, you should only be using public NDK APIs.
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
unfiltered log attached. grep for "tessie". towards the bottom some ominous statements. thanks for any insight.
 

Attachments

  • crash.txt
    306.1 KB · Views: 1,018
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
14 ---> 19. same story... or similar (log looks a little different). sorry it's so big. i don't know where to edit it for you to save you time.
 

Attachments

  • crash.txt
    57.7 KB · Views: 498
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
i guess i could leave it go at that, but could you possibly clarify this line that appears in the log, just below the sigenv error:
type=1400 audit(0.0:91): avc: denied { search } for name="com.georgieapps.tessie" dev="dm-2" ino=409781 scontext=u:r:debuggerd:s0 tcontext=ubject_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
how relevent does such a message strike you?

searching online for similarly worded messages results in many hits, but not much clarification. its meaning seems to be significant only to those who deal with matters at a lower level.

according to the link i referred to above, failures in android 7 resulting from incompatibility will produce an error message whose format is described in the link and which identifies that there is a problem with a native library. i'm not seeing that format in the logs i captured.

thanks.
-go
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…