检查“is Library”是什么意思?复选框“在封面下”吗?

发布于 2024-11-15 08:26:10 字数 486 浏览 3 评论 0原文

我注意到,当我将现有的 Android 应用程序项目转换为 Android 库项目 通过检查“是库”复选框,项目的源代码或 XML 文件没有任何变化。

那么,当选中“is Library”复选框时,到底会发生什么? 包和/或项目文件内部发生了什么变化?我可以在哪里了解更多相关信息?

为了更好地解释我的问题:

  1. 我有兴趣知道什么(主要是 用于故障排除)是 应用程序包与库的区别 包裹“在封面下”?
  2. 事实上,一个项目是 “图书馆项目”标记 某处?如果是的话,它在哪里 标记它(显然不在源代码中 文件,甚至不在 res XML 中 文件)

I noticed that when I convert an existing Android Application project to an Android Library project by checking the "is Library" checkbox, nothing changes in the project's source code or XML files.

So what really happens when the "is Library" checkbox is checked? What changes internally, in the package and/or project files? Where can I learn more about this?

To better explain my question:

  1. What I am interested to know (mainly
    for troubleshooting purposes) is
    what differentiates an Application package from a Library
    package "under the cover"?
  2. Is the fact that a project is
    "Library Project" marked
    somewhere
    ? If so, where does it
    mark it (obviously not in the source
    files and not even in the res XML
    files)

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

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

发布评论

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

评论(3

羁拥 2024-11-22 08:26:10

从命令行页面管理项目

create lib-project 命令创建
标准项目结构
包括预设属性
向构建系统表明
项目是一个图书馆。它通过以下方式做到这一点
将此行添加到项目的
默认.properties 文件:

android.library=true

换句话说,它是由构建系统而不是操作系统使用的属性。

更新:我使用的是 iPhone,所以我不会输入完整的释义,但这里有一篇非常好的博客文章,讨论了 Java JAR 和 Android 库项目之间的差异,包括 dex 工具如何添加资源和 dex 代码到.apk:

http://devmaze.wordpress.com/2011/05/22 /android-application-android-libraries-and-jar-libraries/

From the Managing Projects from the Command Line page:

The create lib-project command creates
a standard project structure that
includes preset property that
indicates to the build system that the
project is a library. It does this by
adding this line to the project's
default.properties file:

android.library=true

In other words, it's a property that is utilized by the build system and not by the operating system.

UPDATE: I'm on my iPhone so I won't type out a whole paraphrase, but here's a pretty good blog article discussing the differences between a Java JAR and an Android Library Project, including how the dex tools add the resources and dex code to the .apk:

http://devmaze.wordpress.com/2011/05/22/android-application-android-libraries-and-jar-libraries/

野稚 2024-11-22 08:26:10

来自开发站点: http://developer.android.com/guide/developing /projects/projects-eclipse.html

您还可以指定一个 Android
项目作为一个图书馆项目,其中
允许与其他人共享
依赖它的项目。曾经一个
Android 项目被指定为
图书馆项目,它不能
安装到设备上。

From the devsite: http://developer.android.com/guide/developing/projects/projects-eclipse.html

You can also designate an Android
project as a library project, which
allows it to be shared with other
projects that depend on it. Once an
Android project is designated as a
library project, it cannot be
installed onto a device.

卸妝后依然美 2024-11-22 08:26:10

库项目并不像您习惯的 jar 那样打包为单独的可再发行文件。它与您的应用程序的 apk 文件合并。

您链接到的页面在 引用库项目 部分。

“属性”对话框关闭后,Eclipse 就会重建项目,包括库项目的内容。

A library project isn't packaged as a seperate redistributable file as you're used to with a jar. It's merged with the the apk file of your application.

The page you linked to mentions it in the Referencing a library project section.

As soon as the Properties dialog closes, Eclipse rebuilds the project, including the contents of the library project.

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