在 Android Studio 中公开隐藏的 API android L (SDK 21) [英] Exposing hidden APIs android L (SDK 21) in Android Studio

查看:23
本文介绍了在 Android Studio 中公开隐藏的 API android L (SDK 21)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功地从 android 模拟器中提取了类文件并将它们替换到我的 android.jar 文件中,该文件位于我的 \platforms\android-21\android.jar 中,但我仍然无法访问隐藏的方法.我以前使用过 android 19,但为了使我的构建保持最新.我知道我可以使用反射,但在 Android Studio 内部支持它要容易得多.

I have successfully extracted the class files from an android emulator and replaced them into my android.jar file residing inside my \platforms\android-21\android.jar and I still cannot access the hidden methods. I have previously used android 19, but to keep my builds up to date. I know I can use reflection, but its so much easier having it natively supported inside Android Studio.

使用 JD-GUI 我可以确认类和方法在 android.jar 文件中,但 Android Studio无法解析符号"中的每一个.我在这里主要感到困惑.谢谢大家.

Using JD-GUI I can confirm that the classes and methods are inside the android.jar file yet Android Studio "cannot resolve symbol" on every one of them. I am confused majorly here. Thanks everyone.

我确实有 repo 设置,所以如果可以从源代码编译 android.jar 文件,我不介意这样做.

I do have repo setup so if compiling the android.jar file from source is possible, I would not mind doing that.

推荐答案

File > Invalidate Caches and Restart > Invalidate and Restart

File > Invalidate Caches and Restart > Invalidate and Restart

我知道有些事情很奇怪.我知道方法就在罐子里,我知道这是 Studio 的东西.它在这里缓存方法:)

I knew something was weird. I knew the methods were there in the jar, I knew it was something with Studio. Here it caches the methods :)

按照我在第一行发布的内容修复它!很高兴!希望其他人受益!

Doing what I posted in the first line fixes it! So happy! Hope others benefit!

这篇关于在 Android Studio 中公开隐藏的 API android L (SDK 21)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆