nenick / AndroidStudioAndRobolectric

Minimal Robolectric and Android Studio example
139 stars 29 forks source link

Fails with org.robolectric:robolectric:3.0-rc3 #22

Open mtotschnig opened 9 years ago

mtotschnig commented 9 years ago

When updating to the latest RC for Robolectric 3.0, the tests no longer work, but lead to the following error:

java.lang.RuntimeException: /Users/mtotschnig/entwicklung/AndroidStudioAndRobolectric/app/build/intermediates/bundles/debug/res/values is not a directory
    at org.robolectric.res.DocumentLoader.load(DocumentLoader.java:27)
    at org.robolectric.res.PackageResourceLoader.loadEverything(PackageResourceLoader.java:32)
    at org.robolectric.res.PackageResourceLoader.doInitialize(PackageResourceLoader.java:19)
    at org.robolectric.res.XResourceLoader.initialize(XResourceLoader.java:29)
    at org.robolectric.res.OverlayResourceLoader.doInitialize(OverlayResourceLoader.java:22)
    at org.robolectric.res.XResourceLoader.initialize(XResourceLoader.java:29)
    at org.robolectric.res.XResourceLoader.getValue(XResourceLoader.java:52)
    at org.robolectric.res.OverlayResourceLoader.getValue(OverlayResourceLoader.java:51)
    at org.robolectric.res.RoutingResourceLoader.getValue(RoutingResourceLoader.java:31)
    at org.robolectric.shadows.ShadowAssetManager.getAndResolve(ShadowAssetManager.java:353)
    at org.robolectric.shadows.ShadowAssetManager.getAndResolve(ShadowAssetManager.java:349)
    at org.robolectric.shadows.ShadowAssetManager.getResourceText(ShadowAssetManager.java:67)
    at android.content.res.AssetManager.getResourceText(AssetManager.java)
    at android.content.res.Resources.getText(Resources.java:270)
    at org.robolectric.shadows.ShadowResources.getText(ShadowResources.java:358)
    at android.content.res.Resources.getText(Resources.java)
    at android.content.res.Resources.getString(Resources.java:360)
    at org.robolectric.shadows.ShadowContext.getString(ShadowContext.java:33)
    at org.robolectric.shadows.ShadowContextWrapper.getString(ShadowContextWrapper.java:78)
    at android.content.Context.getString(Context.java)
    at org.robolectric.util.ActivityController.getActivityTitle(ActivityController.java:108)
    at org.robolectric.util.ActivityController.attach(ActivityController.java:49)
    at org.robolectric.util.ActivityController$1.run(ActivityController.java:121)
    at org.robolectric.shadows.ShadowLooper.runPaused(ShadowLooper.java:305)
    at org.robolectric.shadows.CoreShadowsAdapter$2.runPaused(CoreShadowsAdapter.java:45)
    at org.robolectric.util.ActivityController.create(ActivityController.java:118)
    at org.robolectric.util.ActivityController.create(ActivityController.java:129)
    at org.robolectric.util.ActivityController.setup(ActivityController.java:210)
    at org.robolectric.Robolectric.setupActivity(Robolectric.java:46)
    at com.example.myapplication.RobolectricTest.testIt(RobolectricTest.java:16)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:245)
    at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:185)
    at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:54)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:149)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
´´´
mtotschnig commented 9 years ago

I forgot to mention that this problem is limited to running the test in Android Studio (on MacOS). It works fine when running with Gradle from the command line.

nenick commented 9 years ago

As a fast workaround read Note for Mac User at http://robolectric.org/getting-started/

I will take a look why my workaround does not work anymore.

nenick commented 9 years ago

Now it should work again

nilsi commented 9 years ago

I have this problem to. (on Mac) Already have $MODULE_DIR$ at Defaults -> JUnit -> Working directory Im using: org.robolectric:robolectric:3.0-rc3 Any ideas?

nenick commented 9 years ago

@nilsi What are your steps to get this error? You shouldn't get this if you use the master branch.