问题描述
我已经成功地从android模拟器中提取了类文件,并将其替换为驻留在\ platforms \ android-21 \ android.jar中的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.
我确实有存储库设置,所以如果可以从源代码编译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
我知道有些奇怪.我知道罐子里有方法,我知道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)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!