Android 反射调用 SDK 隐藏方法抛错 NoSuchMethodError
参考文章:针对非 SDK 接口的限制 | Android 开发者 | Android Developers 最近在写 Android 系统应用的时候,因为某些特殊原因无法接触到 AOSP 开发环境,只能通过第三方应用 + 系统签名的方式调试。 其中一个功能是要通过 EthernetManager 获取到 configuration,于是乎首先用先前在 Android 8.0 上的经验,用反射的方式调用方法: EthernetManager.getMethod("getConfiguration", String::class.java) .invoke(getSystemService("ethernet"), target) ?: IpConfiguration.newInstance() 但是这段代码抛错 NoSuchMethodError,直接列举所有方法也只有屈指可数的少数几个方法: 12:29:38.203 ReflectTest…