{"action":"created","issue":{"url":"https://api.github.com/repos/robolectric/robolectric/issues/1623","labels_url":"https://api.github.com/repos/robolectric/robolectric/issues/1623/labels{/name}","comments_url":"https://api.github.com/repos/robolectric/robolectric/issues/1623/comments","events_url":"https://api.github.com/repos/robolectric/robolectric/issues/1623/events","html_url":"https://github.com/robolectric/robolectric/issues/1623","id":61706420,"number":1623,"title":"ResourcesNotFoundException: No such label com.mypackage.myflavourA","user":{"login":"vkislicins","id":6248215,"avatar_url":"https://avatars.githubusercontent.com/u/6248215?v=3","gravatar_id":"","url":"https://api.github.com/users/vkislicins","html_url":"https://github.com/vkislicins","followers_url":"https://api.github.com/users/vkislicins/followers","following_url":"https://api.github.com/users/vkislicins/following{/other_user}","gists_url":"https://api.github.com/users/vkislicins/gists{/gist_id}","starred_url":"https://api.github.com/users/vkislicins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkislicins/subscriptions","organizations_url":"https://api.github.com/users/vkislicins/orgs","repos_url":"https://api.github.com/users/vkislicins/repos","events_url":"https://api.github.com/users/vkislicins/events{/privacy}","received_events_url":"https://api.github.com/users/vkislicins/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/robolectric/robolectric/labels/3.0","name":"3.0","color":"c7def8"},{"url":"https://api.github.com/repos/robolectric/robolectric/labels/defect","name":"defect","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/robolectric/robolectric/milestones/5","html_url":"https://github.com/robolectric/robolectric/milestones/3.0","labels_url":"https://api.github.com/repos/robolectric/robolectric/milestones/5/labels","id":870515,"number":5,"title":"3.0","description":null,"creator":{"login":"erd","id":184194,"avatar_url":"https://avatars.githubusercontent.com/u/184194?v=3","gravatar_id":"","url":"https://api.github.com/users/erd","html_url":"https://github.com/erd","followers_url":"https://api.github.com/users/erd/followers","following_url":"https://api.github.com/users/erd/following{/other_user}","gists_url":"https://api.github.com/users/erd/gists{/gist_id}","starred_url":"https://api.github.com/users/erd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erd/subscriptions","organizations_url":"https://api.github.com/users/erd/orgs","repos_url":"https://api.github.com/users/erd/repos","events_url":"https://api.github.com/users/erd/events{/privacy}","received_events_url":"https://api.github.com/users/erd/received_events","type":"User","site_admin":false},"open_issues":18,"closed_issues":18,"state":"open","created_at":"2014-11-18T01:23:28Z","updated_at":"2015-04-01T16:11:55Z","due_on":null,"closed_at":null},"comments":10,"created_at":"2015-03-14T22:33:04Z","updated_at":"2015-04-01T16:41:22Z","closed_at":null,"body":"Getting the following exception when running a flavoured Robolectric test:\r\n\r\n```\r\n android.content.res.Resources$NotFoundException: no such label com.mypackage.myflavour.a\r\n```\r\n\r\nIn my build.gradle I declare two productFlavors with two different ids - com.mypackage.myflavour and com.mypackage.myflavour.a.\r\n\r\nTo get the right resources like appcompat I use a custom test runner base on the following example:\r\n\r\nhttps://github.com/nenick/AndroidStudioAndRobolectric/blob/master/app/src/test/java/com/example/myapplication/CustomRobolectricRunner.java\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/robolectric/robolectric/issues/comments/88549630","html_url":"https://github.com/robolectric/robolectric/issues/1623#issuecomment-88549630","issue_url":"https://api.github.com/repos/robolectric/robolectric/issues/1623","id":88549630,"user":{"login":"jlw8ke","id":2350815,"avatar_url":"https://avatars.githubusercontent.com/u/2350815?v=3","gravatar_id":"","url":"https://api.github.com/users/jlw8ke","html_url":"https://github.com/jlw8ke","followers_url":"https://api.github.com/users/jlw8ke/followers","following_url":"https://api.github.com/users/jlw8ke/following{/other_user}","gists_url":"https://api.github.com/users/jlw8ke/gists{/gist_id}","starred_url":"https://api.github.com/users/jlw8ke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlw8ke/subscriptions","organizations_url":"https://api.github.com/users/jlw8ke/orgs","repos_url":"https://api.github.com/users/jlw8ke/repos","events_url":"https://api.github.com/users/jlw8ke/events{/privacy}","received_events_url":"https://api.github.com/users/jlw8ke/received_events","type":"User","site_admin":false},"created_at":"2015-04-01T16:41:22Z","updated_at":"2015-04-01T16:41:22Z","body":"I am running into the same issue, and commenting out the applicationIdSuffux has not worked for me.\r\n```\r\nandroid.content.res.Resources$NotFoundException: no such label com.foo.prototype.networkingprototype:string/app_name\r\n```\r\n\r\nLike @vkislicins, I am also using a variation of https://github.com/nenick/AndroidStudioAndRobolectric/blob/master/app/src/test/java/com/example/myapplication/CustomRobolectricRunner.java \r\nfor appcompat support\r\n\r\n```\r\npublic class CustomTestRunner extends RobolectricGradleTestRunner {\r\n\r\n    private static final int MAX_SDK_SUPPORTED_BY_ROBOLECTRIC = 21;\r\n\r\n    public CustomTestRunner(Class<?> testClass) throws InitializationError {\r\n        super(testClass);\r\n    }\r\n\r\n    @Override\r\n    protected AndroidManifest getAppManifest(Config config) {\r\n        AndroidManifest appManifest = super.getAppManifest(config);\r\n        String moduleRoot = getModuleRootPath(config);\r\n\r\n        FsFile androidManifestFile = FileFsFile.from(moduleRoot, appManifest.getAndroidManifestFile().getPath());\r\n        if(!androidManifestFile.exists()) {\r\n            androidManifestFile = FileFsFile.from(moduleRoot,  appManifest.getAndroidManifestFile().getPath().replace(\"bundles\", \"manifests/full\"));\r\n        }\r\n        FsFile resDirectory = FileFsFile.from(moduleRoot, appManifest.getResDirectory().getPath());\r\n        FsFile assetsDirectory = FileFsFile.from(moduleRoot, appManifest.getAssetsDirectory().getPath());\r\n        return new AndroidManifest(androidManifestFile, resDirectory, assetsDirectory) {\r\n            @Override\r\n            public int getTargetSdkVersion() {\r\n                return MAX_SDK_SUPPORTED_BY_ROBOLECTRIC;\r\n            }\r\n\r\n        };\r\n    }\r\n\r\n    private String getModuleRootPath(Config config) {\r\n        String moduleRoot = config.constants().getResource(\"\").toString().replace(\"file:\", \"\");\r\n        return moduleRoot.substring(0, moduleRoot.indexOf(\"/build\"));\r\n    }\r\n}\r\n\r\n```\r\n```\r\nrepositories {\r\n    maven { url = \"https://oss.sonatype.org/content/repositories/snapshots\" }\r\n}\r\n\r\napply plugin: 'com.android.application'\r\nandroid {\r\n    compileSdkVersion project.ext.compileSdkVersion\r\n    buildToolsVersion project.ext.buildToolsVersion\r\n\r\n    defaultConfig {\r\n        applicationId project.ext.applicationId\r\n        minSdkVersion project.ext.minSdkVersion\r\n        targetSdkVersion project.ext.targetSdkVersion\r\n        versionCode project.ext.versionCode()\r\n        versionName project.ext.versionName()\r\n    }\r\n\r\n    buildTypes {\r\n        debug {\r\n            applicationIdSuffix \".debug\"\r\n            testCoverageEnabled true\r\n        }\r\n        release {\r\n            minifyEnabled false\r\n            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\r\n        }\r\n\r\n    }\r\n\r\n    lintOptions {\r\n        abortOnError false\r\n        disable 'InvalidPackage'\r\n    }\r\n\r\n    packagingOptions {\r\n        exclude 'META-INF/LICENSE.txt'\r\n        exclude 'LICENSE.txt'\r\n        exclude 'META-INF/LICENSE'\r\n        exclude 'META-INF/NOTICE'\r\n    }\r\n}\r\n\r\ndependencies {\r\n    compile fileTree(dir: 'libs', include: ['*.jar'])\r\n    compile 'com.android.support:appcompat-v7:22.0.0'\r\n\r\n    // Dagger - Dependency Injection\r\n    compile 'com.squareup.dagger:dagger:1.2.2'\r\n    provided 'com.squareup.dagger:dagger-compiler:1.2.2'\r\n\r\n    // Butter knife - View 'Injection'\r\n    compile 'com.jakewharton:butterknife:6.1.0'\r\n\r\n    // Otto - Event bus\r\n    compile 'com.squareup:otto:1.3.6'\r\n\r\n    //Retrofit\r\n    compile 'com.squareup.retrofit:retrofit:1.9.0'\r\n    compile 'com.squareup.okhttp:okhttp-urlconnection:2.3.0'\r\n    compile 'com.squareup.okhttp:okhttp:2.3.0'\r\n\r\n    // Timber - Logging\r\n    compile 'com.jakewharton.timber:timber:2.5.0'\r\n\r\n    // ================== TESTING LIBRARIES ======================\r\n    testCompile 'junit:junit:4.12'\r\n    testCompile 'org.apache.maven:maven-ant-tasks:2.1.3'\r\n    testCompile ('com.squareup:fest-android:1.0.8') {\r\n        exclude group: 'com.android.support'\r\n    }\r\n    testCompile('org.robolectric:robolectric:3.0-SNAPSHOT') {\r\n        exclude group: 'org.apache.httpcomponents', module: 'httpclient'\r\n        exclude group: 'commons-logging', module: 'commons-logging'\r\n    }\r\n}\r\n```\r\n"}}