如何更新导入模块与code从摇篮/ Android的Studio中的外部库项目修改 [英] How to update imported modules with code modification from the their external library project in Gradle/Android Studio

查看:491
本文介绍了如何更新导入模块与code从摇篮/ Android的Studio中的外部库项目修改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个Android应用程序,其中我最近从Eclipse的移植到Android Studio和摇篮。

在我的预期,我创建5 UI利布斯,并增加他们在我的项目模块,库我已经创建了被压在我的GitHub的账户(公开)。

在当你添加外部依赖的标记为LIB一​​个项目,当你更新外部项目的code,那么你清理你的身材,你的项目获取这些更新,但在摇篮我注意到,它创建物理拷贝蚀,完全独立于它们的来源,我的问题是我怎么能只更改外部库,并有我的项目更新。

下面是一个从我的摇篮的配置剪断:

 相关性{
    //库
    编译文件树(导演:库,包括:['的* .jar'])
    编译com.google.android.gms:播放服务:5.0.89
    。
    。
    。
    编译com.squareup.picasso:毕加索:2.4.0

    //项目
    编制项目(:com.shehabic.helpicon)
    。
    。
}
 

解决方案

您不能添加外部库作为一个模块。在项目文件夹,它会使它的副本。

什么,你需要做的是:

1)删除库文件夹中当前项目。 2)打开seeting.gradle文件,并添加这些:

 包括:your_external_library_module_name',':perhaps_second_external_library

项目(:your_external_library_module_name)。PROJECTDIR =新的文件(../路径/要/你/外部/库)
项目(:perhaps_second_external_library)。PROJECTDIR =新的文件(../路径/要/你/秒/外部/库)
 

2)在你的'build.gradle文件中添加相依为:

 相关性{
    编制项目(:your_external_library_module_name)
    编制项目(:perhaps_second_external_library)
}
 

3)同步项目和你做。

I'm developing an android app, in which I recently migrated from Eclipse to Android Studio and Gradle.

In my projected I created 5 UI Libs, and added them as modules in my project, libs I have created are pushed on my github account (publicly).

In eclipse when you add external dependency for a project marked as lib, when you update the external project's code then you clean your build, your project get these updates, but in Gradle I noticed that it creates Physical Copies, completely independent from their sources, my question is how can I change only external libs and have my project updated.

here's a snipped from my gradle's config:

dependencies {
    // Libraries
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services:5.0.89'
    .
    .
    . 
    compile 'com.squareup.picasso:picasso:2.4.0'

    // Projects
    compile project(':com.shehabic.helpicon')
    .
    .
}

解决方案

You must not add the external library as a module. It will make copy of it under your project folder.

What you have to do is:

1) Delete the library folder in your current project. 2) Open the 'seeting.gradle' file and add these:

include ':your_external_library_module_name', ':perhaps_second_external_library'

project (':your_external_library_module_name').projectDir = new File('../path/to/your/external/library')
project (':perhaps_second_external_library').projectDir = new File('../path/to/your/second/external/library')

2) In your 'build.gradle' file add dependency as:

dependencies {
    compile project(':your_external_library_module_name')
    compile project(':perhaps_second_external_library')
}

3) Sync the project and you are done.

这篇关于如何更新导入模块与code从摇篮/ Android的Studio中的外部库项目修改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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