由于未解决的类型,ApiDemos 3.0 / 3.1将无法构建

我正在尝试为API级别11(3.0)和12(3.1)构建ApiDemos。 我已将最新版本的工具(版本11)和平台工具(版本4)更新到最新版本。 另外,我安装了兼容包。

当我尝试构建ApiDemos项目时,我收到了数千个错误,其中Eclipse显示以下100个错误:

ActionBar cannot be resolved to a type ActionBarDisplayOptions.java /ApiDemos3.1/src/com/example/android/apis/app line 34 Java Problem ActionMode cannot be resolved to a type Grid3.java /ApiDemos3.1/src/com/example/android/apis/view line 133 Java Problem alertDialogIcon cannot be resolved or is not a field AlertDialogSamples.java /ApiDemos3.1/src/com/example/android/apis/app line 82 Java Problem animator cannot be resolved or is not a field FragmentHideShow.java /ApiDemos3.1/src/com/example/android/apis/app line 55 Java Problem Animator cannot be resolved to a type AnimationLoading.java /ApiDemos3.1/src/com/example/android/apis/animation line 73 Java Problem 

我需要帮助让样本正确构建。 谢谢。

似乎兼容性jar文件仅包含对Fragments的支持,而不包含ActionBar等类,这些类仅在API11和12中可用。除非您使用API​​11或12作为目标构建,否则您将无法使用这些类。

它实际上是ApiDemos for API 15的进一步问题的答案。如果有人因为一些错误(在我的情况下大约3000个错误)运行它有问题,那么答案是编辑’project.properties’文件,所以它说target=android-15而不是8

然后重建/清理+重建项目。