如何在姜饼和更低版本的设备上运行 API 级别 14 演示

发布于 2024-12-16 13:57:53 字数 476 浏览 3 评论 0原文

当我从 eclipse 创建一个 API 级别为 14 的新 Android 示例项目时,添加兼容性库并尝试在我的姜饼设备上运行它。它给出了以下错误:

Error Inflating Class SwitchPreference 

我刚刚从首选项 xml 文件中注释了 SwitchPreference 并且能够运行 api 演示应用程序。但是片段(和其他一些)演示不可用。

这是预期的吗?我应该有一个运行 api-14 的设备才能看到 Fragment 演示吗?我在创建项目的过程中遗漏了什么吗?

任何帮助表示赞赏。

When I create a new Android Sample Project from eclipse with api level 14, add the compatibility library and try to run it on my gingerbread device. It gave the following error :

Error Inflating Class SwitchPreference 

I just commented the SwitchPreference from the preferences xml file and was able to run the api demos app. But the Fragment(and few others) demos were not available.

Is this expected? should I have a device running api-14 to be able to see the Fragment demos? Am I missing anything in the process of creating the project?

Any help is appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

国产ˉ祖宗 2024-12-23 13:57:53

兼容性库提供了 Fragment API,但它不会以某种方式将 API 级别 10 设备升级到 API 11 或 14。API 14 的示例项目可能使用除兼容性库未提供的片段之外的其他 API。此外,命名空间也不同。如果您想在 Gingerbread 上运行该示例,则必须做一些工作来将该示例移植回来。我会查看兼容性库中的示例

The compatibility library provides the Fragment API, but it doesn't somehow upgrade your API level 10 device to API 11 or 14. The sample projects for API 14 probably use other APIs besides fragments that the compatibility library does not provide. Additionally, the namespaces are different. You'll have to do some work to port that sample back if you want to run it on Gingerbread. I would look in the samples in the compatibility library instead.

惯饮孤独 2024-12-23 13:57:53

API 13 设备无法运行 API 14 程序。降低应用程序所需的 API 级别(如果可以的话)。如果您没有使用任何 API 14 的东西,它应该适合您。

API 13 devices can't run API 14 programs. Drop the required API level of your application (if you can). If you're not using any API 14 things, it should work for you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文