最好的办法纳入排球(或其他库)到Android的Studio项目 [英] Best way to incorporate Volley (or other library) into Android Studio project

查看:219
本文介绍了最好的办法纳入排球(或其他库)到Android的Studio项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到了不同的意见,这样做<一个href=\"http://stackoverflow.com/questions/17218295/android-gradle-build-system-create-jar-not-library\">This问题介绍了如何创建一个罐子。在其他地方,我见过的建议简单地凌空源复制到自己的项目中。 在android.com在库本节似乎最权威的。但是,编译后抽射,我没有一个AAL库,而该节说我应该有。

I've seen different advice on the best way to do this This question covers creating a jar. Elsewhere, I've seen advice to simply copy the volley source into your own project. This section on libraries at android.com would seem the most authoritative. However, after compiling volley, I don't have an aal library, whereas that section says I should have.

所以我的问题是这样的:我有一个标准布局的现有的Andr​​oid Studio项目,以及一个Git仓库;我应该怎么做补充凌空?我应该在哪里下载到?我应该如何将它添加到Android的工作室?其中摇篮文件,如果有的话,我是否需要修改。

So my question is this: I have an existing Android Studio project with a standard layout, and a git repository; what should I do to add volley? Where should I download it to? How should I add it to Android Studio? Which Gradle files, if any, do I need to modify.

我们希望,对于那些你已经这样做了几次,这应该是面包和奶油的东西,但我一直没能找到一个简单的描述。

Hopefully, for those of you have done this a few times, this should be bread-and-butter stuff, but I haven't been able to find a straightforward description.

-

更新,每斯科特·巴塔的建议。

Updating, per Scott Barta's suggestion.

在凌空库中的gradle.build文件有此行。

The gradle.build file in the volley repository has this line.

apply plugin: 'android-library'

根据文档库项目不产生APK,他们产生.aar包(它代表的Andr​​oid存档)。的然而,当我在建项目抽射,没有创建.aar。

According to the documentation: "Library projects do not generate an APK, they generate a .aar package (which stands for Android archive)." However, when I build the volley project, no .aar is created.

我的感觉是,作为排球是一个库项目,由Android团队创建的,它是最有可能用来生成并用作.aar包。它是否将是preferable任何意见,生成.aar,以及如何做到这一点,将AP preciated。

My feeling is that as Volley is a library project, created by the Android team, it is most probably intended to be generated and used as .aar package. Any advice on whether it would be preferable to generate a .aar, and how to do that, would be appreciated.

推荐答案

您可以在您的build.gradle文件中使用抽射依赖部分使用

You can use this in dependency section of your build.gradle file to use volley

  dependencies {
      compile 'com.mcxiaoke.volley:library-aar:1.0.0'
  }

更新:

它不是正式的官方的,但排球的镜像副本。它会定期同步并加盖排球库更新,所以你可以继续使用它,没有任何后顾之忧。

Its not official but a mirror copy of official Volley. It is regularly synced and updated with official Volley Repository so you can go ahead to use it without any worry.

https://github.com/mcxiaoke/android-volley

这篇关于最好的办法纳入排球(或其他库)到Android的Studio项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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