{"action":"opened","issue":{"url":"https://api.github.com/repos/robolectric/robolectric/issues/1936","labels_url":"https://api.github.com/repos/robolectric/robolectric/issues/1936/labels{/name}","comments_url":"https://api.github.com/repos/robolectric/robolectric/issues/1936/comments","events_url":"https://api.github.com/repos/robolectric/robolectric/issues/1936/events","html_url":"https://github.com/robolectric/robolectric/issues/1936","id":94402986,"number":1936,"title":"Robolectric can't find AndroidManifest.xml when testing multidimensional flavor project on Ubuntu","user":{"login":"ivanthai","id":1041516,"avatar_url":"https://avatars.githubusercontent.com/u/1041516?v=3","gravatar_id":"","url":"https://api.github.com/users/ivanthai","html_url":"https://github.com/ivanthai","followers_url":"https://api.github.com/users/ivanthai/followers","following_url":"https://api.github.com/users/ivanthai/following{/other_user}","gists_url":"https://api.github.com/users/ivanthai/gists{/gist_id}","starred_url":"https://api.github.com/users/ivanthai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivanthai/subscriptions","organizations_url":"https://api.github.com/users/ivanthai/orgs","repos_url":"https://api.github.com/users/ivanthai/repos","events_url":"https://api.github.com/users/ivanthai/events{/privacy}","received_events_url":"https://api.github.com/users/ivanthai/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-10T22:07:06Z","updated_at":"2015-07-10T22:07:06Z","closed_at":null,"body":"I have a multidimensional flavor project that I am trying to test with Robolectric 3.0 with the RobolectricGradleTestRunner\r\n\r\n```\r\nflavorDimensions 'dimenA', 'dimenB'\r\n\r\nandroid {\r\n    productFlavors {\r\n        foo {\r\n            dimension 'dimenA'\r\n        }\r\n        dev {\r\n            dimension 'dimenB'\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nRunning Robolectric tests work on OSX. However, when I run the tests on Ubuntu, I get this error:\r\n\r\n```\r\njava.io.FileNotFoundException: build/intermediates/manifests/full/fooDev/debug/AndroidManifest.xml (No such file or directory)\r\n    at java.io.FileInputStream.open(Native Method)\r\n    at java.io.FileInputStream.<init>(FileInputStream.java:146)\r\n    at org.robolectric.res.FileFsFile.getInputStream(FileFsFile.java:78)\r\n    at org.robolectric.manifest.AndroidManifest.parseAndroidManifest(AndroidManifest.java:131)\r\n    at org.robolectric.manifest.AndroidManifest.getTargetSdkVersion(AndroidManifest.java:445)\r\n    at org.robolectric.RobolectricTestRunner.pickSdkVersion(RobolectricTestRunner.java:430)\r\n    at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:184)\r\n    at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:54)\r\n    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)\r\n    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)\r\n    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)\r\n    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)\r\n    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)\r\n    at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:149)\r\n    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)\r\n    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:86)\r\n    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:49)\r\n    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69)\r\n    at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:48)\r\n    at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)\r\n    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n    at java.lang.reflect.Method.invoke(Method.java:606)\r\n    at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)\r\n    at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)\r\n    at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)\r\n    at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)\r\n    at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)\r\n    at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:105)\r\n    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)\r\n    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n    at java.lang.reflect.Method.invoke(Method.java:606)\r\n    at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)\r\n    at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)\r\n    at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:360)\r\n    at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)\r\n    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)\r\n    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)\r\n    at java.lang.Thread.run(Thread.java:745)\r\n```\r\n\r\nIt is trying to look for the full manifest in build/intermediates/manifests/full/fooDev/debug/AndroidManifest.xml\r\n\r\nBut my full manifest is actually in:\r\nbuild/intermediates/manifests/full/foodev/debug/AndroidManifest.xml\r\n\r\nSo for some reason, the gradle test runner is trying to find a camel-cased flavor name when the Gradle Android plugin generated an all-lower-case flavor name\r\n\r\nI had to side step the issue by creating a CustomRobolectricGradleTestRunner\r\n```\r\nprivate static String getFlavor(Config config) {\r\n        try {\r\n            String ret = ReflectionHelpers.getStaticField(config.constants(), \"FLAVOR\");\r\n            return ret.toLowerCase();\r\n        } catch (Throwable e) {\r\n            return null;\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nAndroid Gradle plugin has always generated all lowercase multiflavor name build directories for multidimensional flavors for me.\r\n\r\nFWIW, both my OSX and Ubuntu filesystems are case insensitive, so I'm not exactly sure why it works on OSX and not on Ubuntu\r\n\r\nI'm not exactly sure what the right fix should be or if I'm doing something wrong. Maybe Android Gradle needs to be more consistent by generating camel-case multiflavor build directories or Robolectric needs to grab the correct flavor name? Let me know what you think. Thanks!"}}