Use internal (com.android.internal) and Hide (@hide) api[4th, custom ADT]

Source: Internet
Author: User
Tags printable characters zip folder

This article is translated from http://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-4-customizing-adt/

In the previous article, I described how to create a custom Original-android.jar and create a custom Android platform to use Original-android.jar. This only enables the use of the hidden API and leaves an obstacle to the internal API: ADT. ADT defines a rule that prohibits the use of classes from com.android.internal.

There are several ways to bypass this restriction rule:

1) Complete ADT source code can be downloaded, can remove or modify the code, compile and then install the new custom version of ADT. The bad place is that you have to configure a 64-bit Linux system, download the source code, compile it. This will take some time, and when the new version of ADT comes out, you'll need to do it again.

2) Another way is to modify the ADT bytecode, just replace the "com/android/inter/**" string for other strings, such as "Com/android/internax".

The second approach can be done through scripting automation, without the need to access the source code, and work under Windows, which is why I explained the second approach in this article.

Modify ADT Byte code

Go to your Eclipse's plugins folder and find the file named Com.android.ide.eclipse.adt_*.jar. Make a backup (in case the modification is wrong), and copy the file to a separate "experimental" folder where the bytecode is modified.

Modify *.jar to *.zip, unzip the file to a separate folder, here's what I got:

Now go to the Com/android/ide/eclipse/adt/internal/project subdirectory and locate the Androidclasspathcontainerinitializer.class file.

The file contains the string "com/android/internal/**", and the next step is to replace the string with another string, such as "com/android/internax/**". Changing the length of a string may be fine, but it's best to replace only one letter, keeping the same length.

I replaced it with notepad++ because it supports nonprinting characters, and non-printable characters are not modified when you edit the printed characters.

After modifying, save the file, zip folder, file name and original version. Take my example: Com.android.ide.eclipse.adt_8.0.1.v201012062107-82219.zip, then rename to *.jar.

Note: Make sure that you compress the files correctly, and you can compare the internal directory structure of the modified zip and original zip.

Now delete the original Adt*.jar file under the Eclipse Plugins folder, copy the modified version, and restart Eclipse.

If there is no problem, it will look like the following:

Summary of steps:
    1. Stop Eclipse
    2. Get the ADT plugin jar file from the Eclipse's plugins folder.
    3. Rename the. jar to a. zip and extract it to a separate directory.
    4. Find Com/android/ide/eclipse/adt/internal/project/androidclasspathcontainerinitializer.class
    5. Replace the string "com/android/internal/**" with "com/android/internax/**"
    6. Zip compress all Files
    7. Rename. zip to. jar
    8. Replace the original ADT jar file under the Eclipse Plugins folder with a modified version
    9. Start Eclipse.

Original: http://mogoweb.net/archives/117

Related Article

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.