本文最后更新于 92 天前,其中的信息可能已经有所发展或是发生改变。
对于静态方法无需实例即可调用
try {
Class<?> lifecycleManagerClass = Class.forName("com.ssy185.sdk.gamehelper.web.LifecycleManager");
// 获取静态实例
Method inst = lifecycleManagerClass.getMethod("inst");
// 调用非静态方法
Method init = lifecycleManagerClass.getMethod("init",Application.class);
Object lifecycleManager = inst.invoke(null);
init.invoke(lifecycleManager,application);
} catch (Exception e) {
Log.d("dqs",Log.getStackTraceString(e));
}