Android 库清单
我正在开发一个适用于 Android 2.2 的应用程序。
我想将两个包移动到 Android 库以重用它。这两个包只包含类,而库也只包含类。
这些课程将使用 GPS、加速度计、指南针和方向传感器。
我的问题是 AndroidManifest.xml。我不知道要设置它。
在阅读 Android 文档时,我发现:库项目的清单文件必须声明它包含的所有共享组件,就像标准 Android 应用程序一样。
这些共享组件是什么?我必须声明所有类别吗?
I'm developing an application for Android 2.2.
I want to move two packages to an Android library to reuse it. These two packages only contains classes, and the library will only contain classes.
These classes will use GPS, Acelerometer, compass and Orientation sensor.
My problem is with AndroidManifest.xml. I don't know to set it up.
Reading Android documentation, I found this: A library project's manifest file must declare all of the shared components that it includes, just as would a standard Android application.
What are these shared components? Have I to declare all classes?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这种情况下,共享组件将是使用类所需的权限。您需要在清单中请求许可才能使用 GPS、加速计、指南针和方向传感器。除此之外,您不必声明任何内容,并且可以像任何其他 Java 类一样使用这些类。如果它们包含活动、服务、广播接收器或发送的广播,您还必须在清单中提及这些内容。
The shared components in this case would be the permissions that are required to use the classes. You need to request permission in the Manifest to use the GPS, Accelerometer, compass, and orientation sensor. Other than that, you shouldn't have to declare anything and you can use the classes just like any other Java class. If they contained Activities, Services, Broadcast Receivers, or sent Broadcasts, you would have to mention those in the Manifest as well.