Android Studio cannot compile my test project, because it cannot resolve the resources. I tried some different settings for the res directory in the gradle.build, but nothing worked. Am I missing something simple here? It's a simple HelloWorld project with nothing individual in it.
I have the following project structure as it was created by the Android Studio wizard (newest release 0.2.5):
In my AndroidManifest.xml there is the usual app name reference: @string/app_name This string is defined in main/res/values/strings.xml (selected in the screenshot above).
The error I get from the IDE (Android Studio) is:
android-apt-compiler: [MyApplicationProject] C:\...\MyApplication\src\main\AndroidManifest.xml:6: error:
Error: No resource found that matches the given name (at 'label' with value '@string/app_name').
The error I get from the command line when i run "gradle tasks" is:
A problem occurred configuring root project 'MyApplicationProject'.
> Failed to notify project evaluation listener.
> Main Manifest missing from C:\...\MyApplicationProject\src\main\AndroidManifest.xml
The res/values folder is used to store the values for the resources that are used in many Android projects to include features of color, styles, dimensions etc.
Resource Manager is a tool window for importing, creating, managing, and using resources in your app. You can open the tool window by selecting View > Tool Windows > Resource Manager from the menu bar or by selecting Resource Manager on the left side bar. Click Add to add a new resource to your project.
Try add the following under defaultConfig (within android {...})
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
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