我正在尝试将我公司的项目从 Maven 迁移到 Gradle,到目前为止,我已经能够将所有 POM 转换为相应的 build.gradle 文件,但是在构建时遇到了子模块中的问题。
- Core-UI
---- Utils
---- FieldPanels
子模块 FieldPanel 使用 Utils 中定义的颜色和其他资源。我尝试将 Utils 项目添加为依赖项,但它不起作用,我错过了什么?
/home/development/AndroidStudioProjects/com.project/core-ui/common.android.fieldpanels/build/bundles/debug/res/layout/base_summary_step_layout.xml:2: error: Error: No resource found that matches the given name (at 'background' with value '@color/wizard_summary_bg').
使用 gradle.build
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.2'
}
}
apply plugin: 'android-library'
android {
sourceSets {
main {
manifest {
srcFile 'AndroidManifest.xml'
}
res {
srcDirs = [
'res'
]
}
}
}
compileSdkVersion 15
buildToolsVersion '17.0'
dependencies {
compile group: 'com.company.ipos.android', name: 'commons.pos.micropos.api', version: '0.0.35-SNAPSHOT'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.6.5'
}
}
repositories {
maven {
credentials {
username mavenUser
password mavenPassword
}
url repoUrl
}
maven {
credentials {
username mavenUser
password mavenPassword
}
url libsReleasesUrl
}
maven {
credentials {
username mavenUser
password mavenPassword
}
url libsSnapshotsUrl
}
}
fieldPanels gradle.build
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.2'
}
}
apply plugin: 'android-library'
repositories {
maven {
credentials {
username mavenUser
password mavenPassword
}
url repoUrl
}
maven {
credentials {
username mavenUser
password mavenPassword
}
url libsReleasesUrl
}
maven {
credentials {
username mavenUser
password mavenPassword
}
url libsSnapshotsUrl
}
}
android {
dependencies {
compile group: 'com.company.ipos.android', name: 'commons.pos.micropos.api', version: '0.0.35-SNAPSHOT'
//compile group: 'com.company.ipos.android', name: 'common.android.utils', version: '0.0.35-SNAPSHOT'
compile project(":common.android.utils")
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.6.5'
}
sourceSets {
main {
manifest {
srcFile 'AndroidManifest.xml'
}
res {
srcDirs = [
'res',
]
}
}
}
compileSdkVersion 15
buildToolsVersion '17.0'
}