I'm having a gradle build issue where I'm getting the error "No resource found that matches the give name ..." for a bunch of @string references in my layout files in the core module which is referencing string from the XML files in other modules.
Here's my basic layout structure (this is an old Eclipse project that I'm trying to convert to gradle in Android Studio).
Main Project Folder
-google-play-services_lib
-MainModule (this is the main module that references the other modules)
-LibraryModule
-ZXing
There's currently nothing in my build.gradle at the main project level and my main settings.gradle only includes the following items:
include ':LibraryModule'
include ':google-play-services_lib'
include ':MainModule'
include ':ZXing'
Here's the build.gradle for my main module that should run when the application is opened.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':LibraryModule')
compile project(':ZXing')
compile project(':google-play-services_lib')
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
All of the "No resource found..." messages that I'm getting are in the MainModule and the strings they are referencing are in the LibraryModule. Any ideas on what might be going wrong in this build here?
EDIT: Adding my LibraryModule gradle.build file per request.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':ZXing')
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}