java.lang.annotation.AnnotationFormatError: Invalid default:
<p>when I use robolectric to make UT, the BaseTest is defined as that:</p>

<p>compileSdkVersion 23</p>

<p>buildToolsVersion "22.0.1"</p>

<p>classpath 'com.android.tools.build:gradle:1.5.0'</p>

<pre><code>testCompile('junit:junit:4.12') {
}
testCompile("org.mockito:mockito-core:1.9.5") {

}
testCompile("org.robolectric:robolectric:3.0") {

}
testCompile('org.robolectric:robolectric-annotations:3.0') {

}


@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class,sdk = 18)
public class TestBase {
    @Test
    public void testBase() throws Exception {
        Assert.assertEquals(1, 1);
    }
}
</code></pre>

<p>but there may show these error:</p>

<pre><code>Exception in thread "main" java.lang.annotation.AnnotationFormatError: Invalid default: public abstract java.lang.Class org.robolectric.annotation.Config.application()
at java.lang.reflect.Method.getDefaultValue(Method.java:611)
at sun.reflect.annotation.AnnotationType.&lt;init&gt;(AnnotationType.java:128)
at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:85)
at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:266)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
at java.lang.Class.createAnnotationData(Class.java:3521)
at java.lang.Class.annotationData(Class.java:3510)
at java.lang.Class.getAnnotation(Class.java:3415)
at com.intellij.junit4.JUnit4TestRunnerUtil.buildRequest(JUnit4TestRunnerUtil.java:210)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:40)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
</code></pre>

<p>And I find some way to solve, I change it :</p>

<pre><code>@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml", application = android.app.Application.class)
public class TestBase {

    @Test
    public void testBase() throws Exception {
        Assert.assertEquals(1, 1);
    }
}
</code></pre>

<p>this way don't solve this problom</p>