Android Question katexmathview - error

derez

Expert
Licensed User
Longtime User
I had an older installation of it which does not run in the modern versions.
I downloaded the katexmathview library and application. It fails with the following errors:
Error occurred on line: 38 (Main)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:155)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
at JHS.KatexMathView.main._activity_create(main.java:395)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at JHS.KatexMathView.main.afterFirstLayout(main.java:105)
at JHS.KatexMathView.main.access$000(main.java:17)
at JHS.KatexMathView.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7918)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:147)
... 19 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/content/ContextCompat;
at katex.hourglass.in.mathlib.MathView.<init>(MathView.java:51)
at mathviewwrapper.mathviewWrapper._initialize(mathviewWrapper.java:73)
... 22 more
Caused by: java.lang.ClassNotFoundException: android.support.v4.content.ContextCompat
... 24 more
** Activity (main) Resume **

Adding the additionaljar line does not help, I checked the sdk and it is installed there.

B4X:
#Additionaljar: com.android.support:support-v4

The cause is: "Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/content/ContextCompat;"

I'll appreciate help here...
 

Johan Schoeman

Expert
Licensed User
Longtime User
It is maybe looking for this with newer android:

androidx.core.content.ContextCompat

Have not tried the project for a very long time. Will see if I can revisit it sometime this weekend.
 
Upvote 0

derez

Expert
Licensed User
Longtime User
There are some errors like that in the forum but what solves there is re-installation of b4a, which does not help me here.
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
There are some errors like that in the forum but what solves there is re-installation of b4a, which does not help me here.
I have wrapped the latest Github Project but get this:

1700902600675.png


The same as what I get when running the old project on my current device...

Not sure why it now renders like this....? Perhaps something to do with the device browser settings?

Anyone that can shed some light on it?
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
There are some errors like that in the forum but what solves there is re-installation of b4a, which does not help me here.
Try to Clean and Jetify the project and see if the compile error goes away.
 
Upvote 0

derez

Expert
Licensed User
Longtime User
It runs on an old device ver 4.0.3 , I get similar screen with the text instead of the mathview.
After cleaning the project I get no mathviews at all...
 
Last edited:
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
It runs on an old device ver 4.0.3 , I get similar screen with the text instead of the mathview.
Maybe someone (@Erel) can give us some direction on how to solve the rendering.
 
Upvote 0

omo

Active Member
Licensed User
Longtime User
I have wrapped the latest Github Project but get this:

View attachment 148049

The same as what I get when running the old project on my current device...

Not sure why it now renders like this....? Perhaps something to do with the device browser settings?

Anyone that can shed some light on it?
If I remember very well how I resolved this kind of problem years ago in webview related blurrish text, I found the problem related to manifest. In the manifest editor, try to add this to the manifest if not there already:

SetApplicationAttribute(Android: hardwareAccelerated, false)
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
If I remember very well how I resolved this kind of problem years ago in webview related blurrish text, I found the problem related to manifest. In the manifest editor, try to add this to the manifest if not there already:

SetApplicationAttribute(Android: hardwareAccelerated, false)
Does not do the trick. A bit lost why it is not rendering correctly (Android 9).
 
Upvote 0

omo

Active Member
Licensed User
Longtime User
Does not do the trick. A bit lost why it is not rendering correctly (Android 9).
Have you checked this thread? And hope you added that attribute rightly to the manifest?
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
Have you checked this thread? And hope you added that attribute rightly to the manifest?
Yes, added it as what it should be but still not rendering correctly. Is it maybe a device setting that should be set?
 
Upvote 0
Top