Android Question ClassNotFoundException

jotajota52

Member
Making a B4X app using Geotools, I'm getting the following error: Error: java.lang.ClassNotFoundException: org.geotools$util$factory$Hints
I have all the jars in additional libraries and all added in the Project Attributes.
Compiling with:

B4A Version: 13.40
Parsing code. (0.01s)
Java Version: 19

This is the jar that I'm using first #AdditionalJar: gt-metadata-33.2 that has the "org/geotools/util/factory/Hints.class"
No matter how I try to call the class, I get the NotFoundException.

This is a test code:
TestGeoTools:
Sub Activity_Create(FirstTime As Boolean)
    Dim pm As B4XPagesManager
    pm.Initialize(Activity)
    If FirstTime Then
        'CopyGeoidFile
        TestLoadHints1
    End If
    
End Sub
Sub TestLoadHints1
    Try
        Dim hints As JavaObject
        hints.InitializeNewInstance("org.geotools.util.factory.Hints", Array As Object())
        Log("Hints instance created: " & hints)
    Catch
        Log("Error: " & LastException.Message)
    End Try
    
End Sub


Sub TestLoadHints2
    Try
        Dim jClass As JavaObject
        jClass.InitializeStatic("java.lang.Class")
        Dim hintsClass As JavaObject = jClass.RunMethod("forName", Array("org.geotools.util.factory.Hints"))
        Dim hints As JavaObject = hintsClass.RunMethod("newInstance", Null)
        Log("Hints instance created: " & hints)
    Catch
        Log("Error: " & LastException.Message)
    End Try
End Sub

Could it be that the library is not compatible with B4A ?
 

Attachments

  • gt-metadata-33.2.jar
    496.5 KB · Views: 23
Top