sometimes you need to use some 'hidden' classes ( with @hide annotations)
here is how I do it with ant build
first you need to get the whole Android framework jars
it's located in 
mydroid/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar
1:
copy it to your project/lib/   
(not libs/,  because ant build will include the jars in libs, but here we just need to use it for symbol resolution)
2: 
customize your ant build.xml
copy the templates from 
- for cupcake donut
- platforms/$API_LEVEL/templates/android_rules.xml
- for eclair froyo
- platforms/$API_LEVEL/ant/ant_rules_r2.xml
- gingerbread
- tools/ant/main_rules.xml
3.
  add a path before the compile task <compile>
 <path id="boot.class.ref">
        <fileset dir="./lib">
            <include name="*.jar" />
        </fileset>
    </path>
then
add a line after <javac>
<compilerarg value="-Xbootclasspath/p:${toString:boot.class.ref}"/$gt;
here I try to update the boot class path with -Xbootclasspath/p option
