如果你手工配置build path,把SDK1.5的android.jar加入到某些工程中,你可能會遇到下面的編譯錯誤:
> Attempt to include a core VM class in something other than a core
> library.
> It is likely that you have attempted to include the core library from
> a desktop
> virtual machine into an application, which will most assuredly not
> work. If
> you really intend to build a core library -- which is only appropriate
> as
> part of creating a full virtual machine binary, as opposed to
> compiling an
> application -- then use the "--core-library" option to suppress this
> error
> message. If you go ahead and use "--core-library" but are in fact
> building
> an application, then please be aware that your build will still fail
> at some
> point; you will simply be denied the pleasure of reading this helpful
> error
> message.
>
這意味著你想把一個案頭VM中的類運用到android應用程式中,比如java.awt.*, java.swing.*, java.bean等。
可用android包參見:available packages on Android,這肯定是不行的。
為瞭解決這個問題,需要修改工程目錄下的.classpath檔案,把其中的path設定成下面的值即可:
<classpathentry kind="con"
path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>