AOSP ~ 开放 SDK 隐藏 API

Preparation

You need to prepare these two files: classes-header.jar and android.jar.

android.jar

Go to /platforms/android-X, where X is the API version. If you want to create custom android.jar for API 29, then go to /platforms/android-29. Copy android.jar from this folder into a temporary folder where we will create our custom android.jar.

Don’t forget to keep the original android.jar because when we accidentally put something wrong, we can go back to the original version. Anyway, you can download the original one from:

https://dl.google.com/android/repository/platform-X_rY.zip

Where X is the API level and Y is the revision number. For example: https://dl.google.com/android/repository/platform-29_r04.zip

Extract the ZIP and you will find the original android.jar.

classes-header.jar

classes-header.jar located in /your_path/aosp/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates

scp user@xxx.xxx.xxx.xxx:/home/user/RK3568_ROCKCHIP_ANDROID12.0_SDK/out/target/common/obj/JAVA_LIBRARIES\
/framework_intermediates/classes-header.jar .

Create Custom android.jar

Move all files from inside folder android into folder custom. Then open folder classes and move everything inside it into folder custom as well. Repeat the steps for the rest classes folders. Whenever you are asked to replace or merge, please select merge.
在这里插入图片描述
On Windows you may select Copy and replace.

Open your terminal and set the directory to folder custom. We will do the final step, creating the JAR.

Run the following command:

jar cvf android.jar *

Now we have our own custom android.jar:

在这里插入图片描述
Copy this android.jar into /platforms/android-29.

参考

https://hardiannicko.medium.com/create-your-own-android-hidden-apis-fa3cca02d345
使用原始文档中的 framework.jar 会导致AndroidStudio编译报错,替换为 classes-header.jar

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值