我使用Android Studio开发Android应用程序,似乎使用gradle来管理依赖,
现在我想添加StickyScrollViewItems ProjectLib作为依赖项,它似乎使用maven,因为我没有看到.gradle配置文件
这是我项目的目录结构(以及我想要的)
我怎么做,所以我可以打电话
import com.emilsjolander.SticlyScrollViewItems.R;
就像示例一样,(请参考StickyScrollViewItems中的工作示例)
顺便说一下,我的android studio版本是0.3.1,并假设我的包含主脚本的主包是com.mycompany.mymainproject好的,我使用
成功将maven依赖项转换为gradlegradle --setupbuild pom
这里生成的gradle文件:
StickyScrollViewItems根目录中的settings.gradle
rootProject.name = 'parent'
include ':library', ':sample'
project(':library').projectDir = "$rootDir/library" as File
project(':sample').projectDir = "$rootDir/sample" as File
StickyScrollViewItems根目录中的build.gradle
allprojects {
apply plugin: 'maven'
group = 'com.emilsjolander.components.StickyScrollViewItems'
version = '0.0.1-SNAPSHOT'
}
subprojects {
apply plugin: 'java'
sourceCompatibility = 1.6
targetCompatibility = 1.6
repositories {
mavenLocal()
maven { url "http://repo.maven.apache.org/maven2" }
}
}
库中的build.gradle
description = 'StickyScrollViewItems - Library'
dependencies {
compile(group: 'com.google.android', name: 'android', version:'4.0.1.2') {
/* This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. */
}
}
现在帮助我在settings.gradle和build.gradle中编写我的prject root和MainProject文件夹
告诉我你是否需要更多信息
答案 0 :(得分:0)
在MyMainProject的build.gradle文件中添加此代码
dependencies {
compile project(':StickyScrollviewItems')
}
希望这应该是有效的