Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Testing in Android Unit Testing - Now Featuring Robolectric! Introducing Robolectric

Solution to: Exception in thread "main" java.lang.annotation.AnnotationFormatError: Invalid default: public abstract jav

After following the steps shown in this video, my test failed. The log showed the following error: Exception in thread "main" java.lang.annotation.AnnotationFormatError: Invalid default: public abstract java.lang.Class org.robolectric.annotation.Config.application()

In order to fix this error, I took two steps: 1) I deleted the .gradle folder from my project, and then rebuilt the project 2) As mentioned by another student in this section, I went to Run -> Edit Configurations -> MainActivityTest -> Working directory and entered the following value: $MODULE_DIR$

I'm not exactly sure why the first step was necessary, but it solved my problem.

First solution was solved my problem too

1 Answer

This worked for me! Thanks

No problem! Glad it helped! :)