添加一个Maven项目在Android应用工作室作为一个依赖 [英] Adding a Maven Project to an Android Studio App as a Dependency

查看:214
本文介绍了添加一个Maven项目在Android应用工作室作为一个依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的Andr​​oid 1.2工作室目前正在开发一个Android应用程序。结果
我想用外部Java项目在我的Andr​​oid应用程序的依赖。这个Java项目是一个Maven项目。结果
我如何添加这个项目直接进入我的Andr​​oid应用程序作为依赖,这样我就可以参考withtin我的Andr​​oid应用在Java / Maven项目的类别?

I am currently developing an Android App using Android Studio 1.2 .
I want to use an external Java Project as a Dependency in my Android App. This Java Project is a Maven Project.
How can I add this project right into my Android App as a dependency, so I can refer to Classes of the Java/Maven Project withtin my Android App?

Android应用程序是使用内置Grandle

The Android App is built using Grandle.

推荐答案

我找到了答案。
你需要安装Maven。然后你用Maven构建这个外部项目。 (你可以使用例如Eclipse的)

I found the answer. You need to have Maven installed. Then you build the external project with maven. (you can use e.g. eclipse)

在此之后,整个项目可以在你的本地Maven仓库中。该位置是 / {USER} /。平方米/库在Windows机器上。

After that, the whole project can be found in your 'local maven repository'. The location is /{USER}/.m2/repository on a Windows machine.

按照结构的项目,你刚刚建成。

Follow the structure to the project, you've just built.

转换为一个名称空间路径此路径:

Convert this path to a name space path:

/{USER}/.m2/repositoryorg/tuda/cdc/pp/classes/1.0

被转换成

org.tuda.cdc.pp:classes-plain:1.0

在最后,请注意双倍积分。

Pay attention to the double points at the end.

现在添加maevnLocal()东西给你项目的grandle文件:

Now add the maevnLocal() thing to you project's grandle file:

allprojects {
    repositories {
        jcenter()
        mavenLocal()
    } 
}

然后添加在依赖以下应用程式的grandle文件:

And then add the following to your app's grandle file under dependencies:

compile 'org.tuda.cdc.pp:classes-plain:1.0'

然后,你需要重新构建/同步与grandle文件的修改项目。之后,你是好去。

Then you need to rebuild / sync the project with the changes of the grandle file. After that you are good to go.

这篇关于添加一个Maven项目在Android应用工作室作为一个依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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