Sunday, 31 March 2013

Roboelectric : AndroidManifest.xml not found or not a file

Hello Friends,

While Running my first android Test Project, I found                                                            
                                                                                                               
the following error:        
                                                                                                                            
java.lang.RuntimeException: java.lang.RuntimeException: D:\workspace\MyProjectTest\.\AndroidManifest.xml not found or not a file; it should point to your project's AndroidManifest.xml
at org.robolectric.RobolectricTestRunner.methodBlock(RobolectricTestRunner.java:95)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.RuntimeException: D:\workspace\MyProjectTest\.\AndroidManifest.xml not found or not a file; it should point to your project's AndroidManifest.xml
at org.robolectric.AndroidManifest.validate(AndroidManifest.java:85)
at org.robolectric.AndroidManifest.getResourcePath(AndroidManifest.java:232)
at org.robolectric.RobolectricContext.getSystemResourcePath(RobolectricContext.java:104)
at org.robolectric.RobolectricTestRunner.setupApplicationState(RobolectricTestRunner.java:181)
at org.robolectric.RobolectricTestRunner.internalBeforeTest(RobolectricTestRunner.java:134)
at org.robolectric.RobolectricTestRunner.methodBlock(RobolectricTestRunner.java:92)
... 15 more

After spending several hours I found the fixed. Actually I am doing a silly mistake during configuring
the test environment.Just forgot to add the project reference , due to this my test project could not
find the Androidmanifest.xml file.

Go to argument tab under junit test run configuration and select the second radio buttoni.e Other and browse and select you android project.

All done now run your project.

Enjoy coding... :)
Cheers :)




Mukesh Yadav

Hi Guys I am from Delhi working as Web/Mobile Application Developer(Android Developer), also have knowledge of Roboelctric and Mockito ,android test driven development... Blogging has been my passion and I think blogging is one of the powerful medium to share knowledge and ideas....

3 comments:

  1. Thanks! You saved me some major headache.

    ReplyDelete
  2. Hey thanks, It helped me alot :D

    ReplyDelete

 

Copyright @ 2013 Android Developer Blog.

Blog Widget by LinkWithin