Why I receive Invoke error: method not found

1k views Asked by At

I try to integrate in Delphi appsFlyer (android)

public abstract interface AppsFlyerConversionListener
{
  @WorkerThread
  public abstract void onInstallConversionDataLoaded(Map<String, String> paramMap);
  public abstract void onInstallConversionFailure(String paramString);
  @WorkerThread
  public abstract void onAppOpenAttribution(Map<String, String> paramMap);
  public abstract void onAttributionFailure(String paramString);
}

public class AppsFlyerLib implements a
{
   public static AppsFlyerLib getInstance() {...}
   public AppsFlyerLib init(String paramString, AppsFlyerConversionListener paramAppsFlyerConversionListener) {...}
   public AppsFlyerLib init(String paramString, AppsFlyerConversionListener paramAppsFlyerConversionListener, Context paramContext) {...}
}

so i translate thoses class in delphi like this :

  {*******************************************************}
  JAppsFlyerConversionListenerClass = interface(IJavaClass)
    ['{FE22E5D8-EF6E-44DE-AE27-45C224FF4E06}']
  end;

  {**********************************************************}
  [JavaSignature('com/appsflyer/AppsFlyerConversionListener')]
  JAppsFlyerConversionListener = interface(IJavaInstance)
    ['{698F89B7-7DD7-4F32-B196-BEE4E16FBD36}']
    procedure onAppOpenAttribution(conversionData: JMap); cdecl;
    procedure onAttributionFailure(errorMessage: JString); cdecl;
    procedure onInstallConversionDataLoaded(conversionData: JMap); cdecl;
    procedure onInstallConversionFailure(errorMessage: JString); cdecl;
  end;
  TJAppsFlyerConversionListener = class(TJavaGenericImport<JAppsFlyerConversionListenerClass, JAppsFlyerConversionListener>) end;

  {****************************************}
  JAppsFlyerLibClass = interface(IJavaClass)
    ['{B2787D1A-BDFB-41A3-B876-05148C26FF3F}']
    {class} function getInstance: JAppsFlyerLib; cdecl;
  end;

  {*******************************************}
  [JavaSignature('com/appsflyer/AppsFlyerLib')]
  JAppsFlyerLib = interface(IJavaInstance)
    ['{F8676840-7A1B-4BA7-BFFD-362668E9927A}']
    function init(key: JString; conversionListener: JAppsFlyerConversionListener): JAppsFlyerLib; cdecl; overload;
    function init(key: JString; conversionListener: JAppsFlyerConversionListener; context: JContext): JAppsFlyerLib; cdecl; overload;
  end;
  TJAppsFlyerLib = class(TJavaGenericImport<JAppsFlyerLibClass, JAppsFlyerLib>) end;

and I implemente the JAppsFlyerConversionListener like this :

TAppsFlyerConversionListener= class(TJavaLocal, JAppsFlyerConversionListener)
  private
  public
    procedure onAppOpenAttribution(conversionData: JMap); cdecl;
    procedure onAttributionFailure(errorMessage: JString); cdecl;
    procedure onInstallConversionDataLoaded(conversionData: JMap); cdecl;
    procedure onInstallConversionFailure(errorMessage: JString); cdecl;
  end;

but now when i call :

FAppsFlyerConversionListener := TAppsFlyerConversionListener.create;
TJAppsFlyerLib.JavaClass.getInstance.init(StringToJstring('xxxxx'), FAppsFlyerConversionListener, TAndroidHelper.Context.getApplicationContext);

I receive :

Invoke error: method not found

any idea why ?

NOTE: even doing TJAppsFlyerLib.JavaClass.getInstance.init(nil, nil, nil) return me

Invoke error: method not found

NOTE2: I don't know if it's matter but we have also the function init in JObjectClass :

  JObjectClass = interface(IJavaClass)
    ['{83BD30EE-FE9B-470D-AD6C-23AEAABB7FFA}']
    {class} function init: JObject; cdecl;
  end;
0

There are 0 answers