简体   繁体   English

在AOSP中,如何生成一个jar,其中包含可以稍后分发以供第三方应用使用的资源,类似于android.jar?

[英]In AOSP how to generate a jar containing resources which can be later distributed to be used in 3rd party apps , similar to android.jar?

We have android.jar and framework-res.apk in AOSP and we refer to the resources as @package-name:type/resource_namae ( eg: @android:drawable/name ) in applications. 我们在AOSP中有android.jar和framework-res.apk,并且在应用程序中将资源称为@package-name:type/resource_namae ( eg: @android:drawable/name ) I want to similarly generate a jar conatining my custom resources, so that developers can use that jar in their apps. 我想类似地生成一个包含我的自定义资源的jar,以便开发人员可以在其应用程序中使用该jar。 Is that possible and how? 那有可能吗?

In addition to JAR files, the Android uses a binary distribution format called Android ARchive(AAR) . 除了JAR文件,Android还使用一种称为Android ARchive(AAR)的二进制分发格式。 The .aar bundle is the binary distribution of an Android Library Project. .aar捆绑包是Android库项目的二进制发行版。

An AAR is similar to a JAR file, but it can contain resources as well as compiled byte-code . AARJAR文件类似,但它可以包含资源以及已编译的字节码 A AAR file can be included in the build process of an Android application similar to a JAR file. 类似于JAR文件, AAR文件可以包含在Android应用程序的构建过程中。

It is possible to create libraries modules which can be used as dependencies in Android projects. 可以创建可用作Android项目依赖项的库模块。 These modules allow you to store source code and Android resources which can be shared between several other Android projects. 这些模块可让您存储可在其他几个Android项目之间共享的源代码和Android资源。

Reference: Creating an Android Library 参考: 创建Android库

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM