在Android Studio中导入库:需要一步一步的解释 [英] Import of a library in Android Studio : need step by step explanations

查看:263
本文介绍了在Android Studio中导入库:需要一步一步的解释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Android Studio的新手。我需要在我的项目中使用这个库: https://github.com/2dxgujun/AndroidTagGroup



我读了他们的解释,但我不明白如何进行......



第1步

  Gradle 

依赖关系{
编译'me.gujun.android .taggroup:library:1.4@aar'
}

我应该粘贴哪个Gradle文件这个 ?那是什么意思 ?特别是库:1.4@aar?我的项目将在哪里找到这个文件和这个文件夹结构me.gujun.android.taggroup?我应该先导入库项目吗?



第1步(第2部分)

  Maven 

< dependency>
< groupId> me.gujun.android.taggroup< / groupId>
< artifactId>库< / artifactId>
< version> 1.4< / version>
< type> apklib< / type>
< /依赖关系>

这是什么意思?我在哪里粘贴此代码?是第二种可能,而不是Gradle,或者我应该在Gradle之外做到这一点?



第2步:好! :)



第3步

  Build 

运行./gradlew assembleDebug(Mac / Linux)



<这是什么?我怎样才能做到这一点 ?详细步骤?



非常感谢您的帮助!

解决方案

所有你需要的是第1步(第1部分)。将 compile 语句添加到您自己的应用程序模块的 build.gradle 中。



在此之后,AS应该向您展示请同步横幅,然后按立即同步。完成之后,您可以开始使用该库。



当您使用gradle时,步骤1(第2部分)不是必需的。只有当您使用Maven而不是Gradle时才需要它。



第3步是编译项目。自述文件中提到了如果您想从源代码构建完整的项目。
您可以做到这一点,并在未来一段时间,您可能需要运行gradlew与定义的任务。因此,只需打开一个控制台,转到您的项目根目录并输入 ./ gradlew assembleDebug 即可进行测试运行。如果你在Windows上,你需要 gradlew.bat assembleDebug (不知道是否需要.bat,但它应该可以工作)。



当然,你可以用你自己的项目来测试相同的命令。 PS:我强烈建议阅读用户指南(至少部分):
com / studio / intro / index.htmlrel =nofollow noreferrer> https://developer.android.com/studio/intro/index.html


I am a newbie with Android Studio. I need to use this library in my project : https://github.com/2dxgujun/AndroidTagGroup

I read their explanations but I don't understand how to proceed...

Step 1

Gradle

dependencies {
   compile 'me.gujun.android.taggroup:library:1.4@aar'
}

In which Gradle file should I paste this ? What does that mean ? Especially the "library:1.4@aar" ? Where will my project find this file and this folder structure me.gujun.android.taggroup ? Should I import the library project before ?

Step 1 (part 2)

Maven

<dependency>
    <groupId>me.gujun.android.taggroup</groupId>
    <artifactId>library</artifactId>
    <version>1.4</version>
    <type>apklib</type>
</dependency>

What does that mean ? Where do I paste this code ? Is it a second possibility instead of Gradle or should I do this in addition to Gradle ?

Step 2 : ok ! :)

Step 3

Build

run ./gradlew assembleDebug (Mac/Linux)

What does this do ? How can I do this ? Detailed steps ?

Thanks a lot for your help !

解决方案

All you need is Step 1 (part 1). Add this compile statement into the build.gradle of your own app module.

After that AS should show you a "please sync" banner and you press "sync now". After that is done you can start using the library.

Step 1 (part 2) is not required when you use gradle. It is only needed when you use Maven instead of Gradle.

Step 3 is just to compile the project. It was mentioned in the readme in case you want to build the complete project from sources. You can do that and some time in the future you probably need to run gradlew with a defined task. So just open a console, go to your project root and type ./gradlew assembleDebug for a test run. If you are on Windows you need gradlew.bat assembleDebug (not sure if .bat is required but it should work).

You can, of course, test that same command with your own project. Should work there as well.

PS: I highly recommend to read the user guide (at least partially): https://developer.android.com/studio/intro/index.html

这篇关于在Android Studio中导入库:需要一步一步的解释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆