简体   繁体   English

如何使用AndroidStudio在Android中创建独立库?

[英]How to create a standalone library in Android using AndroidStudio?

I am very new to JAVA/ Android world. 我对JAVA / Android世界很陌生。 I come from C background. 我来自C背景。 The AndroidStudio / Gradle stuff is a bit overwhelming for me. AndroidStudio / Gradle的东西对我来说有点不知所措。

I am looking to create a library using AndroidStudio. 我正在寻找使用AndroidStudio创建一个库。 But when I click on "Start a new Android Studio Project" it asks me for Application name and then for activity et al. 但是,当我单击“启动新的Android Studio项目”时,它会询问我应用程序名称,然后询问活动等。 This is where it gets confusing for me. 这就是让我感到困惑的地方。 Why would these details be required to create a library module? 为什么要创建库模块需要这些详细信息? Am I missing something here? 我在这里想念什么吗?

I know that there is a File - > New Module Menu and all that stuff, but that comes later once I have set the applicaton details. 我知道有一个“文件”->“新模块菜单”以及所有这些内容,但是稍后在我设置了应用程序详细信息后才出现。 But here, I dont want to create any application, just the lib (similar to a shared library I would create in C using Makefiles/autotools). 但是在这里,我不想创建任何应用程序,仅创建lib(类似于我将使用Makefiles / autotools在C语言中创建的共享库)。

Also, A library in Android world is basically a jar file (like we have *.so in C), right? 另外,Android世界中的库基本上是一个jar文件(就像我们在C中有* .so一样),对吗?

1) While Android tools does accept/use Java JAR files, JARs don't contain Android specific stuff like resources (bitmaps,xml) as well as the necessary meta-data to properly merge all of that into a client project. 1)尽管Android工具确实接受/使用Java JAR文件,但JAR不包含Android特定的内容,例如资源(位图,xml)以及必要的元数据,以将所有这些正确地合并到客户端项目中。 So with the 'new' Gradle based tools we now have AAR format http://tools.android.com/tech-docs/new-build-system/aar-format and the toolchain knows how to handle them. 因此,使用基于“新” Gradle的工具,我们现在具有AAR格式http://tools.android.com/tech-docs/new-build-system/aar-format ,并且工具链知道如何处理它们。

2) Which brings you to Create aar file in Android Studio 2)带您在Android Studio中创建aar文件

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

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