从Delphi 10.4到11.1迁移后,Android服务不再启动
我的应用程序可以使用Delphi 10.4运行。 我迁移到Delphi 11.1。 现在,当活动试图启动Android服务:
04-22 14:22:29.476: W/company.Project(28861): CheckJNI: method to register "dispatchToNative2" not in the given class. This is slow, consider changing your RegisterNatives calls.
04-22 14:22:29.476: E/company.Project(28861): ----- class 'Lcom/embarcadero/services/ProjectSvcProxyInterface;' cl=0x13313888 -----
04-22 14:22:29.476: E/company.Project(28861): objectSize=188 (172 from super)
04-22 14:22:29.476: E/company.Project(28861): access=0x0008.0001
04-22 14:22:29.476: E/company.Project(28861): super='java.lang.Class<java.lang.Object>' (cl=0x0)
04-22 14:22:29.476: E/company.Project(28861): interfaces (1):
04-22 14:22:29.476: E/company.Project(28861): 0: java.lang.Class<java.lang.reflect.InvocationHandler> (cl=0x0)
04-22 14:22:29.476: E/company.Project(28861): vtable (4 entries, 11 in super):
04-22 14:22:29.476: E/company.Project(28861): 0: java.lang.Object com.embarcadero.services.ProjectSvcProxyInterface.CreateProxyClass(java.lang.Class, long)
04-22 14:22:29.476: E/company.Project(28861): 1: void com.embarcadero.services.ProjectSvcProxyInterface.cleanNative(long)
04-22 14:22:29.476: E/company.Project(28861): 2: java.lang.Object com.embarcadero.services.ProjectSvcProxyInterface.dispatchToNative(java.lang.String, java.lang.Object[], long)
04-22 14:22:29.476: E/company.Project(28861): 3: java.lang.Object com.embarcadero.services.ProjectSvcProxyInterface.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
04-22 14:22:29.476: E/company.Project(28861): direct methods (1 entries):
04-22 14:22:29.476: E/company.Project(28861): 0: void com.embarcadero.services.ProjectSvcProxyInterface.<init>()
04-22 14:22:29.476: E/company.Project(28861): instance fields (1 entries):
04-22 14:22:29.476: E/company.Project(28861): 0: long com.embarcadero.services.ProjectSvcProxyInterface.pointer
04-22 14:22:29.476: E/company.Project(28861): Failed to register native method com.embarcadero.services.ProjectSvcProxyInterface.dispatchToNative2(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;J)Ljava/lang/Object; in /data/app/~~YUhiWNL9a1_eFqz34FPS8Q==/fr.company.Project-1Kiklfayuhf-wIP9ug-n6Q==/base.apk
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] JNI DETECTED ERROR IN APPLICATION: JNI RegisterNatives called with pending exception java.lang.NoSuchMethodError: no static or non-static method "Lcom/embarcadero/services/ProjectSvcProxyInterface;.dispatchToNative2(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;J)Ljava/lang/Object;"
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at void com.embarcadero.rtl.ProxyService.onCreateNative(java.lang.Object, java.lang.String) (ProxyService.java:-2)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at void com.embarcadero.rtl.ProxyService.onCreate(java.lang.Object, java.lang.String) (ProxyService.java:51)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at void com.embarcadero.services.ProjectSvc.onCreate() (ProjectSvc.java:40)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at void android.app.ActivityThread.handleCreateService(android.app.ActivityThread$CreateServiceData) (ActivityThread.java:4936)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at void android.app.ActivityThread.access$1900(android.app.ActivityThread, android.app.ActivityThread$CreateServiceData) (ActivityThread.java:310)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:2296)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at boolean android.os.Looper.loopOnce(android.os.Looper, long, int) (Looper.java:226)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at void android.os.Looper.loop() (Looper.java:313)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:8633)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:567)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1133)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579]
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] in call to RegisterNatives
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] from void com.embarcadero.rtl.ProxyService.onCreateNative(java.lang.Object, java.lang.String)
04-22 14:22:29.660: A/company.Project(28861): runtime.cc:669] Runtime aborting...
04-22 14:22:29.660: A/company.Project(28861): runtime.cc:669] Dumping all threads without mutator lock held
迁移需要进行一些调整时,我会得到这一点,例如在清单文件中使用“ Androidx.core.content.fileprovider”,或者随着函数原型的更改,有关权限的某些代码更改。但是,这是相同的应用程序。关于这种错误,我找不到任何信息。
该应用程序使用了与Delphi 11兼容的Kastri的最后一个版本。
我尝试在物理Android 12设备上运行该应用程序。
My application runs fine with Delphi 10.4.
I migrated to Delphi 11.1.
Now, I get this when the activity tries to start the android service :
04-22 14:22:29.476: W/company.Project(28861): CheckJNI: method to register "dispatchToNative2" not in the given class. This is slow, consider changing your RegisterNatives calls.
04-22 14:22:29.476: E/company.Project(28861): ----- class 'Lcom/embarcadero/services/ProjectSvcProxyInterface;' cl=0x13313888 -----
04-22 14:22:29.476: E/company.Project(28861): objectSize=188 (172 from super)
04-22 14:22:29.476: E/company.Project(28861): access=0x0008.0001
04-22 14:22:29.476: E/company.Project(28861): super='java.lang.Class<java.lang.Object>' (cl=0x0)
04-22 14:22:29.476: E/company.Project(28861): interfaces (1):
04-22 14:22:29.476: E/company.Project(28861): 0: java.lang.Class<java.lang.reflect.InvocationHandler> (cl=0x0)
04-22 14:22:29.476: E/company.Project(28861): vtable (4 entries, 11 in super):
04-22 14:22:29.476: E/company.Project(28861): 0: java.lang.Object com.embarcadero.services.ProjectSvcProxyInterface.CreateProxyClass(java.lang.Class, long)
04-22 14:22:29.476: E/company.Project(28861): 1: void com.embarcadero.services.ProjectSvcProxyInterface.cleanNative(long)
04-22 14:22:29.476: E/company.Project(28861): 2: java.lang.Object com.embarcadero.services.ProjectSvcProxyInterface.dispatchToNative(java.lang.String, java.lang.Object[], long)
04-22 14:22:29.476: E/company.Project(28861): 3: java.lang.Object com.embarcadero.services.ProjectSvcProxyInterface.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
04-22 14:22:29.476: E/company.Project(28861): direct methods (1 entries):
04-22 14:22:29.476: E/company.Project(28861): 0: void com.embarcadero.services.ProjectSvcProxyInterface.<init>()
04-22 14:22:29.476: E/company.Project(28861): instance fields (1 entries):
04-22 14:22:29.476: E/company.Project(28861): 0: long com.embarcadero.services.ProjectSvcProxyInterface.pointer
04-22 14:22:29.476: E/company.Project(28861): Failed to register native method com.embarcadero.services.ProjectSvcProxyInterface.dispatchToNative2(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;J)Ljava/lang/Object; in /data/app/~~YUhiWNL9a1_eFqz34FPS8Q==/fr.company.Project-1Kiklfayuhf-wIP9ug-n6Q==/base.apk
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] JNI DETECTED ERROR IN APPLICATION: JNI RegisterNatives called with pending exception java.lang.NoSuchMethodError: no static or non-static method "Lcom/embarcadero/services/ProjectSvcProxyInterface;.dispatchToNative2(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;J)Ljava/lang/Object;"
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at void com.embarcadero.rtl.ProxyService.onCreateNative(java.lang.Object, java.lang.String) (ProxyService.java:-2)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at void com.embarcadero.rtl.ProxyService.onCreate(java.lang.Object, java.lang.String) (ProxyService.java:51)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at void com.embarcadero.services.ProjectSvc.onCreate() (ProjectSvc.java:40)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at void android.app.ActivityThread.handleCreateService(android.app.ActivityThread$CreateServiceData) (ActivityThread.java:4936)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at void android.app.ActivityThread.access$1900(android.app.ActivityThread, android.app.ActivityThread$CreateServiceData) (ActivityThread.java:310)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:2296)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at boolean android.os.Looper.loopOnce(android.os.Looper, long, int) (Looper.java:226)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at void android.os.Looper.loop() (Looper.java:313)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:8633)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:567)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1133)
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579]
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] in call to RegisterNatives
04-22 14:22:29.477: A/company.Project(28861): java_vm_ext.cc:579] from void com.embarcadero.rtl.ProxyService.onCreateNative(java.lang.Object, java.lang.String)
04-22 14:22:29.660: A/company.Project(28861): runtime.cc:669] Runtime aborting...
04-22 14:22:29.660: A/company.Project(28861): runtime.cc:669] Dumping all threads without mutator lock held
Migration required some adjustments like using "androidx.core.content.FileProvider" in manifest file, or some code change about permissions as funtion prototypes changed. However this is the same application. I can't find anything about this kind of error.
The application uses the last release of Kastri which is compatible with Delphi 11.
I try to run the application on an physical android 12 device.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论