Sunday 7 December 2014

Environment setup for Internal/Private APIs

Internal APIs are located in package com.android.internal. 
When you are developing using Android SDK you reference one very important jar file called android.jar. It’s located in Android SDK platform directory SDK_DIR/platforms/platform-X/android.jar (where X is API level, it can be 5 or 10 or any other number). This android.jar has all classes from com.android.internal removed, and all classes, enums, fields and methods marked with @hide removed as well.
There are several ways to use internal APIs. 
1. Get Internal APIs
Method 1: Get from open source
Here is the link where to download all versions of android source code.
http://grepcode.com/project/repository.grepcode.com/java/ext/com.google.android/android/
For example download, android-4.4.2_r1.jar, go to step 3.

Method 2: Get from device
https://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-2-hacking-around/

2. Creating classes.jar
(1) Zip the code to classes.zip (Don’t MAC OS native compression tools, use Betterzip)
(2) Change the extension to .jar.

3. Add to ADT
(1) Project properties->Java Build Path->Libraries->Add External JARs
(2) Order and Export, move the external Jar up than android.jar

Reference:

Some open source launcher:
https://github.com/CyanogenMod/android_packages_apps_Trebuchet/tree/cm-10.2
https://github.com/tjlian616/Android-Launcher2-Standalone
http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android-apps/4.0.1_r1/com/android/launcher2/Launcher.java

https://github.com/AnderWeb/android_packages_apps_Launcher

1 comment:

  1. The world's first online casino site - Lucky Club
    The world's first online casino site · luckyclub Luckyclub – a unique casino that offers exciting features, exclusive promotions, and generous bonuses. · Luckyclub

    ReplyDelete