Android Question Problem with #AdditionalJar:, JavaObject and context


Licensed User

I am using #AdditionalJar: and JavaObject to use an object in a jar file but I am having a problem creating the object with the context.

The java code is this:-

this.proConnectSdk = new ProConnectSdk(this.getApplicationContext());

This error message happens
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(
at anywheresoftware.b4j.object.JavaObject.InitializeNewInstance(
at b4a.example.main._getproconnect(
at b4a.example.main._activity_create(
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(
at anywheresoftware.b4a.BA.raiseEvent2(
at b4a.example.main.afterFirstLayout(
at b4a.example.main.access$100(
at b4a.example.main$
at android.os.Handler.handleCallback(
at android.os.Handler.dispatchMessage(
at android.os.Looper.loop(
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: com.tomtom.telematics.proconnectsdk.commons.AssertTool
at com.tomtom.telematics.proconnectsdk.api.ProConnectSdk.<init>(

At this line of code

Return jo.InitializeNewInstance("com.tomtom.telematics.proconnectsdk.api.ProConnectSdk", Array(context))

The context JavaObject is an Application

Here is my full code

Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region

#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
#AdditionalJar: proconnectsdkapi

Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

'proConnect.InitializeNewInstance("com.tomtom.telematics.proconnectsdk.api.ProConnectSdk", Null)

End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.

End Sub

Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:

Dim Proconnect As JavaObject = GetProConnect

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub GetContext As JavaObject
Return GetBA.GetField("context")

End Sub

Sub GetBA As JavaObject
Dim cls As String = Me
Dim jo As JavaObject
cls =cls.SubString("class ".Length)
Return jo.GetFieldJO("processBA")
End Sub

Sub GetProConnect As JavaObject
Dim jo As JavaObject
Dim context As JavaObject = GetContext

Return jo.InitializeNewInstance("com.tomtom.telematics.proconnectsdk.api.ProConnectSdk", Array(context))

End Sub