【发布时间】:2018-01-25 07:43:21
【问题描述】:
我有以下项目结构:
我想在域模块(域模块是 java-lib)中添加一个数据模块依赖项(数据模块是 android-lib)。完成此操作后,我收到以下消息:
这是我的域\build.gradle 文件:
apply plugin: 'java-library'
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':data')
}
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
还有数据\build.gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 27
defaultConfig {
minSdkVersion 14
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
testOptions {
unitTests {
includeAndroidResources = true
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//<!-- RxJava
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxjava:2.1.7'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.1'
testImplementation 'org.robolectric:robolectric:3.5.1'
//<!-- OrmLite
implementation 'com.j256.ormlite:ormlite-core:5.0'
implementation 'com.j256.ormlite:ormlite-android:5.0'
//<!-- XStream
implementation ('com.thoughtworks.xstream:xstream:1.4.10') {
exclude group: 'xmlpull', module: 'xmlpull'
}
//<!----SLF4J
implementation 'org.slf4j:slf4j-api:1.7.21'
//<!-- RetroFit
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'
}
最后 - 整个项目 build.gradle:
buildscript {
repositories {
jcenter()
google()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我不明白这里到底出了什么问题以及为什么我的项目没有构建。
UPD 设置.gradle
include ':presentation', ':data', ':domain'
【问题讨论】:
-
发布你的 settings.gradle
-
@GabrieleMariotti 请查看更新
标签: android gradle android-gradle-plugin android-library