简体   繁体   English

如何创建外部依赖gradle项目?

[英]How to create external dependency gradle project?

I want to create an android project, that i want to use as a library. 我想创建一个我想用作库的android项目。 I want to use this library as any other gradle library, so my question is, how can i create a library project that i can use later as a dependency. 我想将此库与其他任何gradle库一起使用,所以我的问题是,我如何创建一个库项目,以后可以将其用作依赖项。

So my project for example: com.xyz.core 所以我的项目例如:com.xyz.core

And i want to use this library project as a dependency in my android project like this: compile com.xyz.core 我想将此库项目用作我的android项目中的依赖项,如下所示: compile com.xyz.core

So i want to create a global library, that i can reach from everywhere, and i can use from gradle. 因此,我想创建一个全局库,可以从任何地方访问,也可以从gradle中使用。

How can i do this? 我怎样才能做到这一点?

From Android Documentation : 来自Android文档

To create a new module, select File > New > Module. 要创建新模块,请选择“文件”>“新建”>“模块”。 Select the desire module type then click Next to enter the basic module settings: 选择所需的模块类型,然后单击下一步以输入基本模块设置:

  • Enter an Application Name. 输入应用程序名称。 This name is used as the title of your application launcher icon when it is installed on a device. 该名称在设备上安装时用作应用程序启动器图标的标题。 Enter a Module Name. 输入模块名称。 This text is used as the name of the folder where your Java-based activity files are stored. 此文本用作存储基于Java的活动文件的文件夹的名称。
  • Enter a Package Name and Package Location. 输入包裹名称和包裹位置。 This class package namespace creates the initial package structure for your applications code files and is added as the package attribute in your application's Android manifest file. 此类程序包名称空间为应用程序代码文件创建初始程序包结构,并作为程序包属性添加到应用程序的Android清单文件中。 This manifest value serves as the unique identifier for your application app when you distribute it to users. 当您将清单文件分发给用户时,它将作为应用程序应用程序的唯一标识符。 The package name must follow the same rules as packages in the Java programming language. 软件包名称必须遵循与Java编程语言中的软件包相同的规则。
  • ... ...

To make your Module "public" you can upload it on sites like Github and sync it to bintray (jcenter, maven... . 要使您的模块“公开”,您可以将其上传到Github等网站,并将其同步到bintray(jcenter,maven ...)

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

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