How to create the explicitly build android.jar file that has access to the restricted APIs.?

2.2k Views Asked by At

In wso2 iot document : (https://docs.wso2.com/display/IOTS320/Integrating+the+Android+System+Service+Application)

((The system service app can not be built via the usual android developer SDK, as it requires access to developer restricted APIs. Therefore, you need to replace the existing android.jar file that is under the /platforms/android- directory with the explicitly built android.jar file that has access to the restricted APIs. Download the Android Open Source Project (AOSP) and build the source code to get the jar file for the required SDK level.))

I did not understand how to generate the android.jar file. I studied Linki, but I did not see any clear information about it.Please help me.

2

There are 2 best solutions below

0
madawa On

You can find the required jar in the following repository.

https://github.com/anggrayudi/android-hidden-api

2
AudioBubble On

If you need to call a hidden API, you need to import a jar with full APIs, the jar in SDK is a incompleted one which all hidden APIs are disappeared.

@madawa's answer should works fine for normal application programming.

If you are a programmer coding for a modified AOSP, and this AOSP add some private special APIs, you need to import the jar which is build by the AOSP, the path is: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar.

And remember, the hidden APIs are not guaranteed to stay forever, they may be changed or removed. So if you app needs to run on different API levels, you need to import all the different jar and do the level check.