When running my robolectric tests in IntelliJ I get:
Warning: an error occurred while binding shadow class: ShadowGeoPoint
Warning: an error occurred while binding shadow class: ShadowItemizedOverlay
Warning: an error occurred while binding shadow class: ShadowMapController
Warning: an error occurred while binding shadow class: ShadowMapActivity
Warning: an error occurred while binding shadow class: ShadowMapView
Warning: an error occurred while binding shadow class: ShadowOverlayItem
WARNING: Unable to find path to Android SDK
java.lang.RuntimeException: java.lang.NullPointerException
at com.xtremelabs.robolectric.res.ResourceLoader.init(ResourceLoader.java:158)
at com.xtremelabs.robolectric.res.ResourceLoader.setLayoutQualifierSearchPath(ResourceLoader.java:599)
at com.xtremelabs.robolectric.RobolectricTestRunner.setupApplicationState(RobolectricTestRunner.java:367)
at com.xtremelabs.robolectric.RobolectricTestRunner.internalBeforeTest(RobolectricTestRunner.java:311)
at com.xtremelabs.robolectric.RobolectricTestRunner.methodBlock(RobolectricTestRunner.java:278)
at ...
The ANDROID_HOME ist set but InteliJ does not seem to find it.
Set the sdk.dir
in a local.properties
file by running the following in your project's root dir:
$ android update project -p .
Setting up a local.properties
file is a solution that will work for most IDEs since you don't need to worry about getting environment variables passed around.
I got this from Unable to find Android SDK
. There are also few other options which you may try.
Note : You can add this in the JUnit default settings, so that you don't have to do for each test class
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.