In the previous article, I talked about how to create a custom original-android.jar and create a custom Android platform to use a original-android.jar. This only allows you to use hidden APIs and leaves an obstacle for internal APIs: ADT. ADT defines a rule to prohibit 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. You can remove or modify the code, compile and install the new custom version ADT. The bad thing is that you must configure a 64-bit Linux system, download the source code, and compile it. This takes some time. When the new version of ADT comes out, you need to try again.
2) Another method is to modify the ADT bytecode. You only need to replace the "com/Android/inter/**" string with other strings, such as "com/Android/internax ".
The second method can be automated through scripts, and can work in windows without accessing the source code. This is why I have explained the second method in this article.
Modify the ADT bytecode
Go to your eclipse plugins folder and find the file named com. Android. Ide. Eclipse. ADT _ *. jar. Make a backup (to prevent modification errors) and copy a file to a separate "experimental" folder, where you can modify the bytecode.
Modify *. jar to *. Zip and decompress the file to a separate folder. What I get is as follows:
Go to the COM/Android/IDE/Eclipse/ADT/Internal/Project subdirectory to find the androidclasspathcontainerinitializer. Class file.
This file contains the string "com/Android/Internal/**". The next step is to replace the string with other strings, such as "com/Android/internax /**". Changing the length of a string may be fine, but it is best to replace only one letter to keep the length the same.
I replaced it with notepad ++ because it supports non-printable characters and does not modify non-printable characters when editing printed characters.
After modification, save the file and zip the folder. The file name is the same as the original version. Take my example: com.android.ide.eclipse.adt_8.0.1.v201012062107-82219.zip and rename it *. jar.
Note: Make sure that you compress the file correctly. You can compare the modified ZIP file with the original zip file's internal directory structure.
Delete the original ADT *. jar file in the eclipse plugins folder, copy the modified version, and restart eclipse.
If no problem exists, it is shown in:
Summary:
- Stop eclipse
- Obtain the JAR file of the ADT plug-in from the eclipse plugins folder.
- Rename .jaras .zip and decompress it to a separate directory.
- Find COM/Android/IDE/Eclipse/ADT/Internal/project/androidclasspathcontainerinitializer. Class
- Replace the string "com/Android/Internal/**" with "com/Android/internax /**"
- Zip compression of all files
- Rename. Zip to. Jar
- Replace the original adt jar file in the eclipse plugins folder with the modified version
- Start eclipse.
References:
Using Internal (COM. Android. Internal) and hidden (@ hide) APIs [Part 1, custom ADT]