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…

WebRTC Android 运行 build_aar.py 报错 You can often set treat_warnings_as_errors=false...

编译 webrtc_android 时,build_aar.py 运行时出现警告: 注:xxx.java 使用或覆盖了已过时的 API。 注:有关详细信息,请使用 -Xlint:deprecation 重新编译。 随即出现 python 的错误堆栈提示,编译停止并出现以下提示: ... You can often set treat_warnings_as_errors=false to not treat output as failure (useful when developing locally). [100/30872] ACTION //components/resour…d/toolchain/android:…