Android unit tests used to work just fine now throwing NullPointerException -
so have classes unit test models , after updating android studio, unit tests no longer work following message has idea might mean?
java.lang.nullpointerexception @ org.robolectric.manifest.metadata.init(metadata.java:55) @ org.robolectric.manifest.androidmanifest.initmetadata(androidmanifest.java:343) @ org.robolectric.res.builder.defaultpackagemanager.addmanifest(defaultpackagemanager.java:417) @ org.robolectric.internal.paralleluniverse.setupapplicationstate(paralleluniverse.java:74) @ org.robolectric.robolectrictestrunner.setupapplicationstate(robolectrictestrunner.java:433) @ org.robolectric.robolectrictestrunner$2.evaluate(robolectrictestrunner.java:240) @ org.robolectric.robolectrictestrunner.runchild(robolectrictestrunner.java:188) @ org.robolectric.robolectrictestrunner.runchild(robolectrictestrunner.java:54) @ org.junit.runners.parentrunner$3.run(parentrunner.java:290) @ org.junit.runners.parentrunner$1.schedule(parentrunner.java:71) @ org.junit.runners.parentrunner.runchildren(parentrunner.java:288) @ org.junit.runners.parentrunner.access$000(parentrunner.java:58) @ org.junit.runners.parentrunner$2.evaluate(parentrunner.java:268) @ org.robolectric.robolectrictestrunner$1.evaluate(robolectrictestrunner.java:152) @ org.junit.runners.parentrunner.run(parentrunner.java:363) @ org.junit.runner.junitcore.run(junitcore.java:137) @ com.intellij.junit4.junit4ideatestrunner.startrunnerwithargs(junit4ideatestrunner.java:78) @ com.intellij.rt.execution.junit.junitstarter.preparestreamsandstart(junitstarter.java:212) @ com.intellij.rt.execution.junit.junitstarter.main(junitstarter.java:68) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ com.intellij.rt.execution.application.appmain.main(appmain.java:140) java.lang.runtimeexception: java.lang.nullpointerexception @ org.robolectric.robolectrictestrunner$2.evaluate(robolectrictestrunner.java:244) @ org.robolectric.robolectrictestrunner.runchild(robolectrictestrunner.java:188) @ org.robolectric.robolectrictestrunner.runchild(robolectrictestrunner.java:54) @ org.junit.runners.parentrunner$3.run(parentrunner.java:290) @ org.junit.runners.parentrunner$1.schedule(parentrunner.java:71) @ org.junit.runners.parentrunner.runchildren(parentrunner.java:288) @ org.junit.runners.parentrunner.access$000(parentrunner.java:58) @ org.junit.runners.parentrunner$2.evaluate(parentrunner.java:268) @ org.robolectric.robolectrictestrunner$1.evaluate(robolectrictestrunner.java:152) @ org.junit.runners.parentrunner.run(parentrunner.java:363) @ org.junit.runner.junitcore.run(junitcore.java:137) @ com.intellij.junit4.junit4ideatestrunner.startrunnerwithargs(junit4ideatestrunner.java:78) @ com.intellij.rt.execution.junit.junitstarter.preparestreamsandstart(junitstarter.java:212) @ com.intellij.rt.execution.junit.junitstarter.main(junitstarter.java:68) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ com.intellij.rt.execution.application.appmain.main(appmain.java:140) caused by: java.lang.nullpointerexception @ org.robolectric.manifest.metadata.init(metadata.java:55) @ org.robolectric.manifest.androidmanifest.initmetadata(androidmanifest.java:343) @ org.robolectric.res.builder.defaultpackagemanager.addmanifest(defaultpackagemanager.java:417) @ org.robolectric.internal.paralleluniverse.setupapplicationstate(paralleluniverse.java:74) @ org.robolectric.robolectrictestrunner.setupapplicationstate(robolectrictestrunner.java:433) @ org.robolectric.robolectrictestrunner$2.evaluate(robolectrictestrunner.java:240) ... 18 more java.lang.nullpointerexception @ org.robolectric.manifest.metadata.init(metadata.java:55) @ org.robolectric.manifest.androidmanifest.initmetadata(androidmanifest.java:343) @ org.robolectric.res.builder.defaultpackagemanager.addmanifest(defaultpackagemanager.java:417) @ org.robolectric.internal.paralleluniverse.setupapplicationstate(paralleluniverse.java:74) @ org.robolectric.robolectrictestrunner.setupapplicationstate(robolectrictestrunner.java:433) @ org.robolectric.robolectrictestrunner$2.evaluate(robolectrictestrunner.java:240) @ org.robolectric.robolectrictestrunner.runchild(robolectrictestrunner.java:188) @ org.robolectric.robolectrictestrunner.runchild(robolectrictestrunner.java:54) @ org.junit.runners.parentrunner$3.run(parentrunner.java:290) @ org.junit.runners.parentrunner$1.schedule(parentrunner.java:71) @ org.junit.runners.parentrunner.runchildren(parentrunner.java:288) @ org.junit.runners.parentrunner.access$000(parentrunner.java:58) @ org.junit.runners.parentrunner$2.evaluate(parentrunner.java:268) @ org.robolectric.robolectrictestrunner$1.evaluate(robolectrictestrunner.java:152) @ org.junit.runners.parentrunner.run(parentrunner.java:363) @ org.junit.runner.junitcore.run(junitcore.java:137) @ com.intellij.junit4.junit4ideatestrunner.startrunnerwithargs(junit4ideatestrunner.java:78) @ com.intellij.rt.execution.junit.junitstarter.preparestreamsandstart(junitstarter.java:212) @ com.intellij.rt.execution.junit.junitstarter.main(junitstarter.java:68) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ com.intellij.rt.execution.application.appmain.main(appmain.java:140) java.lang.nullpointerexception @ org.robolectric.manifest.metadata.init(metadata.java:55) @ org.robolectric.manifest.androidmanifest.initmetadata(androidmanifest.java:343) @ org.robolectric.res.builder.defaultpackagemanager.addmanifest(defaultpackagemanager.java:417) @ org.robolectric.internal.paralleluniverse.setupapplicationstate(paralleluniverse.java:74) @ org.robolectric.robolectrictestrunner.setupapplicationstate(robolectrictestrunner.java:433) @ org.robolectric.r process finished exit code -1
i checked build variants
are in test artifact unit tests
this happened me after updating android studio. if notice first 2 lines of error metadata
, androidmanifest
throwing npe:
java.lang.nullpointerexception @ org.robolectric.manifest.metadata.init(metadata.java:55) @ org.robolectric.manifest.androidmanifest.initmetadata(androidmanifest.java:343)
so using roboelectric starts classes this:
@config(sdk = 16, manifest = "src/main/androidmanifest.xml") @runwith(robolectrictestrunner.class) public class myclasstest{ //tests class here }
so noticed android studio androidmanifest file 1 level unit test changed past snippet for:
@config(sdk = 16, manifest = "../src/main/androidmanifest.xml") //notice ../ added @ beggining
now work fine.
Comments
Post a Comment