I'm trying to add one more resource folder in my Android project. I created a new folder extra-res so my project structure looks like this:
+ src
+ main
+ res
+ layout
+ ...etc...
+ extra-res
+ layout
So I added this to build.gradle:
android {
.........
sourceSets {
main {
res.srcDirs = ['res', 'extra-res']
}
}
}
But after editing the build.gradle file the build fails.
:app:processDebugResources C:\Users\vovasoft\AndroidStudioProjects\sdbm\app\build\intermediates\manifests\full\debug\AndroidManifest.xml
Error:(13, 23) No resource found that matches the given name (at 'icon' with value '@drawable/ic_launcher').
Error:(14, 24) No resource found that matches the given name (at 'label' with value '@string/app_name').Error:Execution failed for task ':app:processDebugResources'. com.android.ide.common.internal.LoggedErrorException: Failed to run command:
aapt.exe package -f --no-crunch -I android.jar -M \AndroidStudioProjects\sdbm\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S \AndroidStudioProjects\sdbm\app\build\intermediates\res\debug -A \AndroidStudioProjects\sdbm\app\build\intermediates\assets\debug -m -J C:\Users\vovasoft\AndroidStudioProjects\sdbm\app\build\generated\source\r\debug -F (at 'label' with value '@string/activity_edit_field').
Before editing build.gradle the build was successful.
I gave you some wrong information when I answered your original question in https://stackoverflow.com/a/28176489/2985303. That'll teach me about not testing an answer before posting it. You need to more fully qualify the resource directory paths, like so:
android {
sourceSets {
main {
res.srcDirs = ['src/main/res', 'src/main/extra-res']
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With