轉自http://babyfs.wordpress.com/2010/09/03/android%E9%9B%9C%E8%A8%98/
Eclipse import Android2.2 Email source code
(//android/packages/apps/Email/),build failed,一直有compiler
error,花了兩天的時間,終於搞定
- the
import android.provider.Calendar cannot be resolved
- root cause :
android.provider.Calendar是Android internal
package,沒有放在sdk裡,要去找出這個包含Calendar的jar檔(/out/target/common/obj
/JAVA_LIBRARIES/framework_intermediates/classes.jar),然後在Eclipse
- Right-Click your project to open properties
- Java Build Path->Add Library->User Library->User
Libraries->New
- Made up a name & check the “System Library” option
- Select the library you created->Add JARs
- Make sure all JARs you need are added to the project, and click OK
- mContext cannot be resolved
– root cause: Android release的sdk和source
code不mapping,必需自行用Linux重新build過Android.jar,from device directory, 『make
sdk』 will generate android.jar to
./out/host/linux-x86/sdk/android-sdk_eng.user_linux-x86/,接著用新build的
Android.jar換掉原本的,就大功告成了
- source code not found problem
– 在trace Android source code,無法看到source的問題,可以把整個source tree,放到
android-sdk-windows/platforms/android-8/sources/下,重build workspace即可解決