Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Method not found issue with 3rd party SDK


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 5 - Last Post: Oct 18, 2017 2:37 AM Last Post By: Markus Humm
Markus Humm

Posts: 24
Registered: 12/17/09
Method not found issue with 3rd party SDK  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 17, 2017 5:31 AM
Hello,

I'm still working on the integration of this 3rd party API in my Berlin based app:
https://integrate.teamviewer.com/en/develop/screen-sharing-sdk/android-sdk-reference/

The issue is, that the build method is not being found at runtime:
"Invoke error: method not found"

I have the following API header declaration:

unit com.teamviewer.sdk.screensharing.api.TVSessionConfiguration_Builder;
 
interface
 
uses
  AndroidAPI.JNIBridge,
  Androidapi.JNI.JavaTypes,
  com.teamviewer.sdk.screensharing.api.TVSessionCode,
  com.teamviewer.sdk.screensharing.api.TVConfigurationID,
  com.teamviewer.sdk.screensharing.api.TVSessionConfiguration;
 
type
  JTVSessionConfiguration_Builder = interface;
 
  JTVSessionConfiguration_BuilderClass = interface(JObjectClass)
    ['{55477D2A-259C-41B1-997D-CEFA6DAA862E}']
    function init(configurationID : JTVConfigurationID) : JTVSessionConfiguration_Builder; cdecl; overload;
    function init(sessionCode : JTVSessionCode) : JTVSessionConfiguration_Builder; cdecl; overload;
  end;
 
  [JavaSignature('com/teamviewer/sdk/screensharing/api/TVSessionConfiguration$Builder')]
  JTVSessionConfiguration_Builder = interface(JObject)
    ['{9A663C8D-6872-4847-A9D4-9F3EEB875781}']
    function build : JTVSessionConfiguration; cdecl;                            
    function setServiceCaseDescription(description : JString) : JTVSessionConfiguration_Builder; cdecl;
    function setServiceCaseName(sessionCodeName : JString) : JTVSessionConfiguration_Builder; cdecl;
  end;
 
  TJTVSessionConfiguration_Builder = class(TJavaGenericImport<JTVSessionConfiguration_BuilderClass, JTVSessionConfiguration_Builder>) end;
 
implementation
 
end.


Here is an excerpt of my simple test app:

    procedure sb_TeamViewerClick(Sender: TObject);
  private
    FConfigurationID : JTVConfigurationID;
    FSessionBuilder  : JTVSessionConfiguration_Builder;
    FSessionConfig   : JTVSessionConfiguration;
  public
  end;
 
var
  Form1: TForm1;
 
implementation
 
uses
  Androidapi.JNI.JavaTypes,
  Androidapi.Helpers;
 
{$R *.fmx}
 
procedure TForm1.sb_TeamViewerClick(Sender: TObject);
begin
  try
    FConfigurationID := TJTVConfigurationID.JavaClass.init(StringToJString(tf_ConfigurationID.Text));
    m_Log.Lines.Add('ConfigID: ' + JStringToString(FConfigurationID.getConfigurationID));
 
    FSessionBuilder := TJTVSessionConfiguration_Builder.JavaClass.init(FConfigurationID);
    FSessionBuilder.setServiceCaseName(StringToJString(tf_SupportCaseName.Text));
    FSessionBuilder.setServiceCaseDescription(StringToJString(m_Description.Lines.Text));
// This method is not being found:
    FSessionConfig := FSessionBuilder.build;
 
    m_Log.Lines.Add('Session code: ' + FSessionConfig.getSessionCode.ToString);
    m_Log.Lines.Add('Session code name: ' + JStringToString(FSessionConfig.getSessionCodeName));
    m_Log.Lines.Add('Session description: ' + JStringToString(FSessionConfig.getDescription));
  except
    on e:Exception do
      ShowMessage(e.Message);
  end;
end;


I can prove that the FConfigurationID is properly being created and the calls to
setServiceCaseName and setServiceCaseDescription do not complain. Just the call to .build crashes
with said method not found exception.

Any hints for me where this can come from and what I need to change?
There are no relevant messages in the logcat log either.

Greetings

Markus
Markus Humm

Posts: 24
Registered: 12/17/09
Re: Method not found issue with 3rd party SDK  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 17, 2017 7:01 AM   in response to: Markus Humm in response to: Markus Humm
Hello,

dumping the relevant .class file with javap reveals, that the build method is in that class and
that my signature looks ok.

Further analyzing the crash shows, that Androidapi.JNIMarshal's ExecJNI get's passed a InvokeData record
where the MethodID pointer is nill.

But:

a) why?
b) what to do about it?

Greetings

Markus
Dave Nottage

Posts: 1,850
Registered: 1/7/00
Re: Method not found issue with 3rd party SDK  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 17, 2017 1:15 PM   in response to: Markus Humm in response to: Markus Humm
Markus Humm wrote:

b) what to do about it?

File a bug report, pointing to the line of RTL code where it returns the nil MethodID.

You might want to include exactly where the SDK can be obtained, i.e.:

https://integrate.teamviewer.com/en/develop/screen-sharing-sdk/android-tutorial/

--
Dave Nottage [MVP, TeamB]
Find hints, tips and tricks at Delphi Worlds blog: http://www.delphiworlds.com
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: Method not found issue with 3rd party SDK  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 17, 2017 2:13 PM   in response to: Dave Nottage in response to: Dave Nottage
Am 17.10.2017 um 22:15 schrieb Dave Nottage (TeamB):
Markus Humm wrote:

b) what to do about it?

File a bug report, pointing to the line of RTL code where it returns the nil MethodID.

You might want to include exactly where the SDK can be obtained, i.e.:

https://integrate.teamviewer.com/en/develop/screen-sharing-sdk/android-tutorial/

Hello,

I'm in contact with somebody else about this matter as well.
He seems to have found out that one of my declarations is wrong.

Will have to check this tomorrow morning.

Greetings

Markus
Dave Nottage

Posts: 1,850
Registered: 1/7/00
Re: Method not found issue with 3rd party SDK  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 17, 2017 2:17 PM   in response to: Markus Humm in response to: Markus Humm
Markus Humm wrote:

He seems to have found out that one of my declarations is wrong.

Will have to check this tomorrow morning.

I'm curious as to what is wrong, because it looks OK

--
Dave Nottage [MVP, TeamB]
Find hints, tips and tricks at Delphi Worlds blog: http://www.delphiworlds.com
Markus Humm

Posts: 24
Registered: 12/17/09
Re: Method not found issue with 3rd party SDK  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 18, 2017 2:37 AM   in response to: Dave Nottage in response to: Dave Nottage
Hello,

it is fixed by now. In the TVSessionConfiguration API header declaration the attribute
was pointing to a wrong java class. It was pointing to a "bogus" $1 class.

Greetings

Markus
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02