How to use the Android system to hide the hide's classes and methods

Source: Internet
Author: User

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:

  1. 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.
  2. Put Classes.jar under a folder, then unzip it, we can get a android folder and META_INF folder,
  3. 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.
  4. classes.jarcopy 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.
  5. 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
  6. 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.
  7. 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:
    1. 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.
    2. 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.
    3. 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.
    4. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.