#1403·Shadow

Shadow 不兼容 unity 如何解决? Shadow 如果插件 app 为 unity 项目会报错,A/gin_host:plugi:jni_internal.cc:893] JNI FatalError 称为: com/unity3d/player/GoogleARCoreApi

作者: SirLuo创建于 2025年10月27日更新于 2025年11月10日

如果插件的app为依赖库为unityLibrary。unityLibrary中lib 中jar包unity-classes.jar中GoogleARCoreApi类 public final native void initializeARCore(Activity var1); 方法签名和com.Tencent.shadow.core.runtime.ShadowActivity 方法签名不一致,so加载报错。 package com.unity3d.player; import android.app.Activity; public class GoogleARCoreApi { public GoogleARCoreApi() { } public final native void initializeARCore(Activity var1); public final native void pauseARCore(); public final native void resumeARCore(); } 错误如下: 2025-10-27 13:11:41.735 31867-31867/com.lph.plugin_host E/gin_host:plugi: ----- class 'Lcom/unity3d/player/GoogleARCoreApi;' cl=0x15c40078 ----- 2025-10-27 13:11:41.735 31867-31867/com.lph.plugin_host E/gin_host:plugi: objectSize=184 (172 from super) 2025-10-27 13:11:41.735 31867-31867/com.lph.plugin_host E/gin_host:plugi: access=0x0000.0001 2025-10-27 13:11:41.735 31867-31867/com.lph.plugin_host E/gin_host:plugi: super='java.lang.Class<java.lang.Object>' (cl=0x0) 2025-10-27 13:11:41.735 31867-31867/com.lph.plugin_host E/gin_host:plugi: vtable (3 entries, 11 in super): 2025-10-27 13:11:41.735 31867-31867/com.lph.plugin_host E/gin_host:plugi: 0: void com.unity3d.player.GoogleARCoreApi.initializeARCore(com.Tencent.shadow.core.runtime.ShadowActivity) 2025-10-27 13:11:41.735 31867-31867/com.lph.plugin_host E/gin_host:plugi: 1: void com.unity3d.player.GoogleARCoreApi.pauseARCore() 2025-10-27 13:11:41.735 31867-31867/com.lph.plugin_host E/gin_host:plugi: 2: void com.unity3d.player.GoogleARCoreApi.resumeARCore() 2025-10-27 13:11:41.735 31867-31867/com.lph.plugin_host E/gin_host:plugi: direct methods (1 entries): 2025-10-27 13:11:41.735 31867-31867/com.lph.plugin_host E/gin_host:plugi: 0: void com.unity3d.player.GoogleARCoreApi.<init>() 2025-10-27 13:11:41.735 31867-31867/com.lph.plugin_host E/gin_host:plugi: Failed to register native method com.unity3d.player.GoogleARCoreApi.initializeARCore(Landroid/app/Activity;)V in /data/user/0/com.lph.plugin_host/files/ShadowPluginManager/UnpackedPlugin/test-dynamic-manager/937ee1dcf0c8277cddf7a7c2fd235c92/plugin-debug.zip/plugin-app-plugin-debug.apk 2025-10-27 13:11:41.735 31867-31867/com.lph.plugin_host A/gin_host:plugi: jni_internal.cc:893] JNI FatalError called: com/unity3d/player/GoogleARCoreApi 2025-10-27 13:11:42.001 1734-1778/? E/AA: ===========>>> isAutoFanCtrl : true temp : 43 2025-10-27 13:11:42.015 1818-1818/? W/ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1570 android.content.ContextWrapper.startService:669 app.App$11.run:756 android.os.Handler.handleCallback:883 android.os.Handler.dispatchMessage:100 2025-10-27 13:11:42.016 780-19512/? W/ActivityManager: Unable to start service Intent { cmp=com.ankai.cardvr/.service.ProxyService } U=0: not found 2025-10-27 13:11:42.429 1734-2003/? E/Keeper: ServiceKeeper pkg: com.syu.radio action: com.syu.radio.broadcast.MyService START BIND 2025-10-27 13:11:42.429