<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Can't unit test with Esri's Android Runtime SDK in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/can-t-unit-test-with-esri-s-android-runtime-sdk/m-p/213872#M1406</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, thanks for the information. You can try to call ArcGISRuntime.initialize() to force the initialization of ArcGIS Runtime. However, I'm not clear if your unit tests are running in a headless environment and I believe the product was designed to work on a device; so you will likely still need a graphical environment to run the unit tests.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Mar 2020 16:25:02 GMT</pubDate>
    <dc:creator>GayleYoung</dc:creator>
    <dc:date>2020-03-09T16:25:02Z</dc:date>
    <item>
      <title>Can't unit test with Esri's Android Runtime SDK</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/can-t-unit-test-with-esri-s-android-runtime-sdk/m-p/213868#M1402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm writing some unit tests in my android application and every call to Esri's Android Runtime SDK throws a null pointer exeption.&lt;/P&gt;&lt;P&gt;The method&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #808000;"&gt;@Test
&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;public void &lt;/SPAN&gt;addition_isCorrect() {
    SpatialReference wgs84 = SpatialReferences.&lt;SPAN&gt;getWgs84&lt;/SPAN&gt;();
    &lt;SPAN&gt;assertEquals&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;4&lt;/SPAN&gt;, &lt;SPAN style="color: #0000ff;"&gt;2 &lt;/SPAN&gt;+ &lt;SPAN style="color: #0000ff;"&gt;2&lt;/SPAN&gt;);
}&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... breaks with the following stack trace:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;java.lang.ExceptionInInitializerError&lt;BR /&gt; at com.esri.arcgisruntime.internal.jni.CoreSpatialReference.&amp;lt;clinit&amp;gt;(SourceFile:40)&lt;BR /&gt; at com.esri.arcgisruntime.geometry.SpatialReference.&amp;lt;init&amp;gt;(SourceFile:149)&lt;BR /&gt; at com.esri.arcgisruntime.geometry.SpatialReference.create(SourceFile:86)&lt;BR /&gt; at com.esri.arcgisruntime.geometry.SpatialReferences.&amp;lt;clinit&amp;gt;(SourceFile:26)&lt;BR /&gt; at br.gov.ba.conder.vistorias.ExampleUnitTest.addition_isCorrect(ExampleUnitTest.java:18)&lt;BR /&gt; at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&lt;BR /&gt; at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)&lt;BR /&gt; at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)&lt;BR /&gt; at java.lang.reflect.Method.invoke(Method.java:498)&lt;BR /&gt; at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)&lt;BR /&gt; at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)&lt;BR /&gt; at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)&lt;BR /&gt; at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)&lt;BR /&gt; at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)&lt;BR /&gt; at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)&lt;BR /&gt; at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)&lt;BR /&gt; at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)&lt;BR /&gt; at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)&lt;BR /&gt; at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)&lt;BR /&gt; at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)&lt;BR /&gt; at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)&lt;BR /&gt; at org.junit.runners.ParentRunner.run(ParentRunner.java:363)&lt;BR /&gt; at org.junit.runner.JUnitCore.run(JUnitCore.java:137)&lt;BR /&gt; at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)&lt;BR /&gt; at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)&lt;BR /&gt; at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)&lt;BR /&gt; at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)&lt;BR /&gt;Caused by: java.lang.NullPointerException&lt;BR /&gt; at com.esri.arcgisruntime.ArcGISRuntimeEnvironment.c(SourceFile:250)&lt;BR /&gt; at com.esri.arcgisruntime.ArcGISRuntimeEnvironment.&amp;lt;clinit&amp;gt;(SourceFile:50)&lt;BR /&gt; ... 27 more&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I'm doing wrong?&lt;/P&gt;&lt;P&gt;I'm using the Android Runtime SDK 100.6.0&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:29:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/can-t-unit-test-with-esri-s-android-runtime-sdk/m-p/213868#M1402</guid>
      <dc:creator>PlinioSantos</dc:creator>
      <dc:date>2021-12-11T10:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Can't unit test with Esri's Android Runtime SDK</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/can-t-unit-test-with-esri-s-android-runtime-sdk/m-p/213869#M1403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;what Android OS version are you using (from android.os.Build.VERSION.RELEASE)? Also, does the Android SDK work for you in a very basic mapping application; such as a Sample? It sounds like the ArcGISRuntimeEnvironment is not initialized yet. There may be a good reason for that or it may be that we should force initialization. I need a little more information to work out whether we should expect this environment to initialize.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2020 10:51:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/can-t-unit-test-with-esri-s-android-runtime-sdk/m-p/213869#M1403</guid>
      <dc:creator>GayleYoung</dc:creator>
      <dc:date>2020-03-09T10:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: Can't unit test with Esri's Android Runtime SDK</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/can-t-unit-test-with-esri-s-android-runtime-sdk/m-p/213870#M1404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Gayle, since the error is regarding unit testing (the test source set), the android version should not matter because those tests runs outside a device or emulator.&lt;/P&gt;&lt;P&gt;Anyway, the android version I'm currently using is API 28 (&lt;SPAN style="background-color: #ffffff;"&gt;android.os.Build.VERSION.RELEASE = 9&lt;/SPAN&gt;). The&amp;nbsp;application is working fine and I can navigate maps, add graphics and so on, just the unit tests are getting that error.&lt;/P&gt;&lt;P&gt;In order to use&amp;nbsp;ArcGIS Runtime SDK for Android in tests both unit and instrumentation, have I to do any inicialization?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2020 12:59:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/can-t-unit-test-with-esri-s-android-runtime-sdk/m-p/213870#M1404</guid>
      <dc:creator>PlinioSantos</dc:creator>
      <dc:date>2020-03-09T12:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: Can't unit test with Esri's Android Runtime SDK</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/can-t-unit-test-with-esri-s-android-runtime-sdk/m-p/213871#M1405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;More info:&amp;nbsp;I can run instrumentated tests containing calls to ArcGIS Runtime. The mais difference between unit tests and instrumentated test are the the last ones must run in a device or emulator. So, it really seems that unit tests are missing some library initialization. How can I force the inicialization of ArcGIS Runtime for android?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2020 13:59:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/can-t-unit-test-with-esri-s-android-runtime-sdk/m-p/213871#M1405</guid>
      <dc:creator>PlinioSantos</dc:creator>
      <dc:date>2020-03-09T13:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: Can't unit test with Esri's Android Runtime SDK</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/can-t-unit-test-with-esri-s-android-runtime-sdk/m-p/213872#M1406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, thanks for the information. You can try to call ArcGISRuntime.initialize() to force the initialization of ArcGIS Runtime. However, I'm not clear if your unit tests are running in a headless environment and I believe the product was designed to work on a device; so you will likely still need a graphical environment to run the unit tests.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2020 16:25:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/can-t-unit-test-with-esri-s-android-runtime-sdk/m-p/213872#M1406</guid>
      <dc:creator>GayleYoung</dc:creator>
      <dc:date>2020-03-09T16:25:02Z</dc:date>
    </item>
    <item>
      <title>Re: Can't unit test with Esri's Android Runtime SDK</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/can-t-unit-test-with-esri-s-android-runtime-sdk/m-p/213873#M1407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unit tests still dont work with&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;ArcGISRuntime.initialize(). I guess you're right and&amp;nbsp;ArcGIS Runtime for Android must run in actual devices or emulators. This is a shame once unit testing is&amp;nbsp;a good&amp;nbsp;development practice.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2020 16:53:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/can-t-unit-test-with-esri-s-android-runtime-sdk/m-p/213873#M1407</guid>
      <dc:creator>PlinioSantos</dc:creator>
      <dc:date>2020-03-09T16:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: Can't unit test with Esri's Android Runtime SDK</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/can-t-unit-test-with-esri-s-android-runtime-sdk/m-p/1296635#M6065</link>
      <description>&lt;P&gt;Hi, two years later, I'm running into the same issue with Kotlin. Can't believe nobody does unit testing in the meantime. Could you solve the issue &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/40703"&gt;@PlinioSantos&lt;/a&gt;?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 12:55:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/can-t-unit-test-with-esri-s-android-runtime-sdk/m-p/1296635#M6065</guid>
      <dc:creator>padmalcom</dc:creator>
      <dc:date>2023-06-07T12:55:43Z</dc:date>
    </item>
  </channel>
</rss>

