如何从 Android 源代码导入单个项目
据我了解,所有内置标准应用程序(例如电子邮件、音乐、日历等)都是使用相同的 API 构建的。所以我应该能够导入像邮件/音乐等项目,而无需检查 android 的完整源代码存储库。我一直在尝试,但遇到了诸如类解析失败之类的编译问题。
我做错了吗?我是否必须获取完整的 android 源项目才能导入 Mail 等项目?
As far as I understand, all the built-in standard apps like (email, music, calendar etc) are built using the same API. So I should be able to import a project like mail / music etc without checking out the full source repository of android. I'v been trying that but I am getting compilation problems like class resolve failure.
Am I doing it wrong? Do I have to get the full android source project to import a project like Mail ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这些应用程序是开源的(邮件、音乐和日历)。但它们依赖于内部类和资源,无法使用 SDK 编译
These apps are open source (mail, music and calendar). But they depend on internal classes and resources and can't be compiled with the SDK
您可以提取某个特定应用程序的 Git 克隆。例如 -
https://android.googlesource.com/platform/packages 中的电子邮件应用/apps/Email/
第一个问题是 Google 使用 MK 文件来构建其 Android 项目,而 Eclipse 不使用它们。但您可以编译它,因为您还有源代码、XML 资源和清单。
第二个问题是处理依赖关系。例如,图库应用程序可能依赖于少数相机类别。您可以手动将它们复制到您的项目中。
其他方式是:
使用 Eclipse 编写代码并测试其是否正确构建,并使用 http://www.gnu.org 将构建提供的 Android.MK 文件并运行应用程序的工具。
You could pull a Git clone of some particular app. For example - the EMail app from
https://android.googlesource.com/platform/packages/apps/Email/
The first problem is that Google are using MK files for building inside their android projects and Eclipse do not use them. But you can compile it because you have the sources, the XML resources and the manifest also.
The second problem is to deal with the dependencies. For example the gallery app may depend on few camera classes. You can manually copy them to your project.
Other way is:
Using Eclipse for writing code and testing if it builds correctly and using GNU Make 3.82 from http://www.gnu.org tool that will build the supplied Android.MK file and run the app.