android应用程序访问隐藏的api

前言

在android系统开发中需要添加一些aidl文件。 这些aidl是hide的,应用程序无法直接的使用,从而引出了应用程序如何访问内部内藏的api接口

步骤

1.android在编译完成后,会生成framework.jar。难道应用程序要使用这个framework.jar吗?
其实不是的,需要使用的是

out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/class.jar

这个class.jar文件
2.在android studio中,将这个class.jar作为一个module加入工程

File->Project structure -> +(左上角) > 选择 import .jar (导入jar包)-> Moduless下出现classes -> 选择app下 dependencise -> + (右上角)> 添加 module,选择添加的classes,同时将compile 修改为provides
3. 在app下的build.gradule下添加 dexOptions {
javaMaxHeapSize “4g”
}

4.在工程app下的android defaultconfig 下添加 mutiDexEnabled true
5. app下 dependencies {
compile ’com.android.support:multidex:1.0.0‘
}
6.在Minifest application 中添加
android:name =”android.support.multidex.MultiDexApplication”

总结

在android系统开发中通过这样的方式,就可以访问一些内部的接口文件。

参考文献

How do I build the Android SDK with hidden and internal APIs available?
Creating a module library and adding it to module dependencies
Android Studio Google jar causing GC overhead limit exceeded error
Building Apps with Over 65K Methods

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值