lostdev
lostdev

Reputation: 736

How do you set the resource directory in gradle file?

I imported a project from one pc to another and my gradle files are all screwed up. It is complaining that my res folder isn't at the right path. I already use the following line for the manifest file:

sourceSets {
    main {
             manifest.srcFile 'app\\src\\main\\AndroidManifest.xml'
         }
}

Can I set the overall source directory (for java files and res files) somehow? Or set them individually?

Note: It appears that the path gradle is trying to use is missing the 'app'

For Reference, here is the error:

C:\MyProject\build\intermediates\manifests\debug\AndroidManifest.xml
Error:(24, 23) No resource found that matches the given name (at 'icon' with value '@drawable/ic_launcher').
Error:(25, 24) No resource found that matches the given name (at 'label' with value '@string/app_name').
Error:(26, 24) No resource found that matches the given name (at 'theme' with value '@style/AppTheme').
Error:(29, 28) No resource found that matches the given name (at 'label' with value '@string/app_name').

Upvotes: 2

Views: 3591

Answers (1)

lostdev
lostdev

Reputation: 736

Solution which I found 2 minutes later. Guess I shouldn't code late at night.

sourceSets {
    main {
        java.srcDirs 'app\\src\\main\\java'
        res.srcDirs 'app\\src\\main\\res'
        manifest.srcFile 'app\\src\\main\\AndroidManifest.xml'
    }
}

Upvotes: 2

Related Questions