How to use the Android system to hide the hide classes and methods Welcome to Wxtlife.com
In the application development process, you may need to use the methods of the system, such as: SystemProperties
and the system hides hide's methods and classes, such as: Android 4.2 Surface.screenshot(x,y)
method is hidden, Android 4.3 after the method is turned into SurfaceControl.screenshot(x,y)
and SurfaceControl
This class has also become a hidden one. So how do you do it directly in Eclipse or Android studio? Here's how to teach you:
- First compile the Android system, in fact, directly compile the framework is also OK, after the compilation is complete,
out\target\common\obj\JAVA_LIBRARIES\framework_intermediates
there is a classes.jar
file below, we need this jar file.
- Put Classes.jar under a folder, then unzip it, we can get a
android
folder and META_INF
folder,
- Find the SDK version directory that we used to use
android.jar
, such as: sdk\platforms\android-19\android.jar
, to put it under a folder to extract. After extracting, you will get a lot of folders, including: android,java,com,javax,org,META_INF
folders and resources.arsc
files.
classes.jar
copy all the files under the extracted Android folder to the android.jar
extracted Android folder and overwrite the files and folders with the same file name. In fact, you notice that the above two Android folder content is roughly the same.
- The following is the most critical step, is to package the existing folder classes into a Java file, first in the root directory of the decompression Android.jar open the cmd Command window, enter the command
jar cvfm android.jar META-INF/MANIFEST.MF ./
. If the jar cannot be found, configure the environment variable first. Then we see this packed details in the console output. For detailed command parameters for jars, see the jar command in detail here
- Smooth, you can get a
android.jar
file, and then extract the jar file to see if and the original structure has been, do not pack a layer of file directory yo, otherwise certainly no way to use, if correct, will replace the files in our SDK android.jar
. For example, replace: sdk\platforms\android-19\android.jar
file.
- Then test, open eclipse, just type in a Java file in an Android project to
SurfaceControl
see if the system will prompt US SurfaceControl
to import the package, pay attention to more than 4.3 only SurfaceControl
yo, if not then look at the detection of which step is wrong.
Easy Error Summary:
- To ensure that the first step to generate the
classes.jar
file is correct, some system packaging classes default is in the Classes.odex, if extracted out of the Android folder is basically the problem.
- Whether to use the
classes.jar
extracted Android folder to completely overwrite the android.jar
contents of the extracted Android folder. Because the hidden method is under the classes.jar
extracted Android folder.
- In the packaging of the command, folder and directory errors, resulting in the packaging of the jar more than a layer of folders, or a layer (less packaging other folders), about the size of about
android.jar
20M.
- The jar command parameter is incorrect, please refer to the method and meaning of using the jar method parameter.
Welcome to visit wxtlife.com
How to use the Android system to hide the hide's classes and methods