<?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: Update regarding branching and versioning of maps in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/update-regarding-branching-and-versioning-of-maps/m-p/1088338#M5589</link>
    <description>&lt;P&gt;Hello &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/509972"&gt;@Latheesh&lt;/a&gt; I think the immediate error you are seeing is caused by a mistake in the code. I have reproduced the code above and I see the following stack trace:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-SPOILER&gt;java.lang.RuntimeException: Unable to start activity ComponentInfo{com.esri.arcgisruntime.app.runWithAndroidAPIAndDailyBuild/com.esri.arcgisruntime.app.MainActivity}: com.esri.arcgisruntime.ArcGISRuntimeException: Invalid call.: ServiceGeodatabase must be loaded&lt;BR /&gt;at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3654)&lt;BR /&gt;at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3806)&lt;BR /&gt;at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)&lt;BR /&gt;at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)&lt;BR /&gt;at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)&lt;BR /&gt;at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2267)&lt;BR /&gt;at android.os.Handler.dispatchMessage(Handler.java:107)&lt;BR /&gt;at android.os.Looper.loop(Looper.java:237)&lt;BR /&gt;at android.app.ActivityThread.main(ActivityThread.java:8154)&lt;BR /&gt;at java.lang.reflect.Method.invoke(Native Method)&lt;BR /&gt;at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)&lt;BR /&gt;at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)&lt;BR /&gt;Caused by: com.esri.arcgisruntime.ArcGISRuntimeException: Invalid call.: ServiceGeodatabase must be loaded&lt;BR /&gt;at com.esri.arcgisruntime.internal.jni.CoreServiceGeodatabase.nativeGetTable(Native Method)&lt;BR /&gt;at com.esri.arcgisruntime.internal.jni.CoreServiceGeodatabase.b(SourceFile:2)&lt;BR /&gt;at com.esri.arcgisruntime.data.ServiceGeodatabase.getTable(SourceFile:1)&lt;BR /&gt;at com.esri.arcgisruntime.app.MainActivity.onCreate(MainActivity.kt:42)&lt;BR /&gt;at android.app.Activity.performCreate(Activity.java:7963)&lt;BR /&gt;at android.app.Activity.performCreate(Activity.java:7952)&lt;/LI-SPOILER&gt;&lt;P&gt;The immediate stack trace is not very helpful but further down we see:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;Caused by: com.esri.arcgisruntime.ArcGISRuntimeException: Invalid call.: ServiceGeodatabase must be loaded&lt;BR /&gt;at com.esri.arcgisruntime.internal.jni.CoreServiceGeodatabase.nativeGetTable(Native Method)&lt;BR /&gt;at com.esri.arcgisruntime.internal.jni.CoreServiceGeodatabase.b(SourceFile:2)&lt;BR /&gt;at com.esri.arcgisruntime.data.ServiceGeodatabase.getTable(SourceFile:1)&lt;BR /&gt;at com.esri.arcgisruntime.app.MainActivity.onCreate(MainActivity.kt:42)&lt;/P&gt;&lt;P&gt;So the error is caused by the getTable call. getTable can only be called once the ServiceGeodatabase has been loaded, so the call must be placed in the addDoneLoadingListener.&lt;/P&gt;&lt;P&gt;Doing so stops the app from crashing but the ServiceGeodatabase still fails to load with the following load error:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;Service Geodatabase failed to load: com.esri.arcgisruntime.ArcGISRuntimeException: Invalid argument.: Cannot load a non-versioned service with a version name, null&lt;/P&gt;&lt;P&gt;(Note: in order to see the full error, you need to change your logging code to print out the exception as well as its cause. Sometimes, exceptions do not have causes. You can make the following change:)&lt;/P&gt;&lt;LI-CODE lang="kotlin"&gt;Log.e("Tag", "Service Geodatabase failed to load: ${it}, ${it.cause}")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To fix this, the ServiceGeodatabase constructor should be changed so that it does not specify a versionName parameter (see below discussion about branch versioning). After making this change, the layer in that service table can be displayed on a map successfully. I have included a full code snippet below, which should load the ServiceGeodatabase's layer on a map, and display it on the screen, although you must also create a corresponding layout which contains a MapView with id mapView.&lt;/P&gt;&lt;LI-CODE lang="kotlin"&gt;import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import com.esri.arcgisruntime.mapping.ArcGISMap
import com.esri.arcgisruntime.mapping.Basemap
import kotlinx.android.synthetic.main.activity_main.*
import com.esri.arcgisruntime.data.ServiceGeodatabase
import com.esri.arcgisruntime.layers.FeatureLayer
import com.esri.arcgisruntime.loadable.LoadStatus

class MainActivity : AppCompatActivity() {

    // Keep ServiceGeodatabase as a field in the class so that it doesn't get
    // garbage collected while it is being loaded.
    private lateinit var mServiceGeodatabase: ServiceGeodatabase

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        mapView.map = ArcGISMap(Basemap.createDarkGrayCanvasVector())

        mServiceGeodatabase = ServiceGeodatabase(
            "https://services3.arcgis.com/df7XtT0Re4z8S561/arcgis/rest/services/Chimpanzee/FeatureServer"
        )
        // ServiceGeodatabase is a Loadable, so we must trigger its loading before we can use it.
        mServiceGeodatabase.loadAsync()
        mServiceGeodatabase.addDoneLoadingListener {
            if (mServiceGeodatabase.loadStatus != LoadStatus.LOADED) {
                mServiceGeodatabase.loadError?.let {
                    Log.e("Tag", "Service Geodatabase failed to load: ${it}, ${it.cause}")
                }
                return@addDoneLoadingListener
            }

            Log.i("Tag", "ServiceGeodatabase loaded")
            // Code for getting the table is now here inside the doneLoadingListener.
            val serviceFeatureTable = mServiceGeodatabase.getTable(0)
            val layer = FeatureLayer(serviceFeatureTable)
            mapView.map.operationalLayers.add(layer)
        }
        // Any code placed below the listener will most-likely happen _before_ the listener code
        // is executed, since the listener code waits for the Geodatabase to load -- it is asynchronous.
    }

    override fun onResume() {
        super.onResume()
        mapView.resume()
    }

    override fun onPause() {
        mapView.pause()
        super.onPause()
    }

    override fun onDestroy() {
        mapView.dispose()
        super.onDestroy()
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regarding branch versioning, I can direct you to this &lt;A href="https://developers.arcgis.com/android/kotlin/sample-code/edit-with-branch-versioning/" target="_self"&gt;Android sample&lt;/A&gt; which explains the process and gives an example.&lt;/P&gt;&lt;P&gt;I hope this helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 12 Aug 2021 10:08:54 GMT</pubDate>
    <dc:creator>FinlayPearson</dc:creator>
    <dc:date>2021-08-12T10:08:54Z</dc:date>
    <item>
      <title>Update regarding branching and versioning of maps</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/update-regarding-branching-and-versioning-of-maps/m-p/1088057#M5579</link>
      <description>&lt;P&gt;Can someone help me regarding branching and versioning of the app? As i am using the servicegeodatabase it is throwing an error it must be loaded. Do we need any requirements to use servicegeodatabase&lt;/P&gt;</description>
      <pubDate>Wed, 11 Aug 2021 18:52:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/update-regarding-branching-and-versioning-of-maps/m-p/1088057#M5579</guid>
      <dc:creator>Latheesh</dc:creator>
      <dc:date>2021-08-11T18:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: Update regarding branching and versioning of maps</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/update-regarding-branching-and-versioning-of-maps/m-p/1088271#M5580</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/509972"&gt;@Latheesh&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;do you have a picture of the error?&amp;nbsp;&lt;/P&gt;&lt;P&gt;also, how did you configure this, generally you connect to the sde. connection for branch versioning in ArcGIS Pro and in the web apps&lt;/P&gt;&lt;P&gt;Are you using a web app or experience builder widget?&amp;nbsp;If you are using the Experience builder, this page may be useful&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://doc.arcgis.com/en/experience-builder/configure-widgets/branch-version-management-widget.htm" target="_blank"&gt;Branch Version Management widget—ArcGIS Experience Builder | Documentation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 05:28:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/update-regarding-branching-and-versioning-of-maps/m-p/1088271#M5580</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-08-12T05:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: Update regarding branching and versioning of maps</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/update-regarding-branching-and-versioning-of-maps/m-p/1088303#M5587</link>
      <description>&lt;P&gt;Hi I am using mobile application to implement the branch versioning.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;serviceGeodatabase&lt;/SPAN&gt;=ServiceGeodatabase(&lt;SPAN&gt;"https://services3.arcgis.com/df7XtT0Re4z8S561/arcgis/rest/services/Chimpanzee/FeatureServer"&lt;/SPAN&gt;,&lt;SPAN&gt;"1"&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN&gt;  serviceGeodatabase.addDoneLoadingListener {&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;            if (serviceGeodatabase.loadStatus != LoadStatus.LOADED) {&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;               serviceGeodatabase.loadError?.let {&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;                    Log.e("Tag", "Service Geodatabase failed to load: ${it.cause}")&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;                }&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;                return@addDoneLoadingListener&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;            }&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;        }&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;        serviceFeatureTable=serviceGeodatabase.getTable(0)&lt;BR /&gt;It is showing error saying servicegeodatabase must be loaded in the error&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Aug 2021 06:56:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/update-regarding-branching-and-versioning-of-maps/m-p/1088303#M5587</guid>
      <dc:creator>Latheesh</dc:creator>
      <dc:date>2021-08-12T06:56:39Z</dc:date>
    </item>
    <item>
      <title>Re: Update regarding branching and versioning of maps</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/update-regarding-branching-and-versioning-of-maps/m-p/1088304#M5588</link>
      <description>&lt;P&gt;Do we need to setup any additional from arcgis to get access for servicegeodatabase aside from the mobile application side?&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 06:59:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/update-regarding-branching-and-versioning-of-maps/m-p/1088304#M5588</guid>
      <dc:creator>Latheesh</dc:creator>
      <dc:date>2021-08-12T06:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: Update regarding branching and versioning of maps</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/update-regarding-branching-and-versioning-of-maps/m-p/1088338#M5589</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/509972"&gt;@Latheesh&lt;/a&gt; I think the immediate error you are seeing is caused by a mistake in the code. I have reproduced the code above and I see the following stack trace:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-SPOILER&gt;java.lang.RuntimeException: Unable to start activity ComponentInfo{com.esri.arcgisruntime.app.runWithAndroidAPIAndDailyBuild/com.esri.arcgisruntime.app.MainActivity}: com.esri.arcgisruntime.ArcGISRuntimeException: Invalid call.: ServiceGeodatabase must be loaded&lt;BR /&gt;at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3654)&lt;BR /&gt;at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3806)&lt;BR /&gt;at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)&lt;BR /&gt;at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)&lt;BR /&gt;at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)&lt;BR /&gt;at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2267)&lt;BR /&gt;at android.os.Handler.dispatchMessage(Handler.java:107)&lt;BR /&gt;at android.os.Looper.loop(Looper.java:237)&lt;BR /&gt;at android.app.ActivityThread.main(ActivityThread.java:8154)&lt;BR /&gt;at java.lang.reflect.Method.invoke(Native Method)&lt;BR /&gt;at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)&lt;BR /&gt;at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)&lt;BR /&gt;Caused by: com.esri.arcgisruntime.ArcGISRuntimeException: Invalid call.: ServiceGeodatabase must be loaded&lt;BR /&gt;at com.esri.arcgisruntime.internal.jni.CoreServiceGeodatabase.nativeGetTable(Native Method)&lt;BR /&gt;at com.esri.arcgisruntime.internal.jni.CoreServiceGeodatabase.b(SourceFile:2)&lt;BR /&gt;at com.esri.arcgisruntime.data.ServiceGeodatabase.getTable(SourceFile:1)&lt;BR /&gt;at com.esri.arcgisruntime.app.MainActivity.onCreate(MainActivity.kt:42)&lt;BR /&gt;at android.app.Activity.performCreate(Activity.java:7963)&lt;BR /&gt;at android.app.Activity.performCreate(Activity.java:7952)&lt;/LI-SPOILER&gt;&lt;P&gt;The immediate stack trace is not very helpful but further down we see:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;Caused by: com.esri.arcgisruntime.ArcGISRuntimeException: Invalid call.: ServiceGeodatabase must be loaded&lt;BR /&gt;at com.esri.arcgisruntime.internal.jni.CoreServiceGeodatabase.nativeGetTable(Native Method)&lt;BR /&gt;at com.esri.arcgisruntime.internal.jni.CoreServiceGeodatabase.b(SourceFile:2)&lt;BR /&gt;at com.esri.arcgisruntime.data.ServiceGeodatabase.getTable(SourceFile:1)&lt;BR /&gt;at com.esri.arcgisruntime.app.MainActivity.onCreate(MainActivity.kt:42)&lt;/P&gt;&lt;P&gt;So the error is caused by the getTable call. getTable can only be called once the ServiceGeodatabase has been loaded, so the call must be placed in the addDoneLoadingListener.&lt;/P&gt;&lt;P&gt;Doing so stops the app from crashing but the ServiceGeodatabase still fails to load with the following load error:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;Service Geodatabase failed to load: com.esri.arcgisruntime.ArcGISRuntimeException: Invalid argument.: Cannot load a non-versioned service with a version name, null&lt;/P&gt;&lt;P&gt;(Note: in order to see the full error, you need to change your logging code to print out the exception as well as its cause. Sometimes, exceptions do not have causes. You can make the following change:)&lt;/P&gt;&lt;LI-CODE lang="kotlin"&gt;Log.e("Tag", "Service Geodatabase failed to load: ${it}, ${it.cause}")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To fix this, the ServiceGeodatabase constructor should be changed so that it does not specify a versionName parameter (see below discussion about branch versioning). After making this change, the layer in that service table can be displayed on a map successfully. I have included a full code snippet below, which should load the ServiceGeodatabase's layer on a map, and display it on the screen, although you must also create a corresponding layout which contains a MapView with id mapView.&lt;/P&gt;&lt;LI-CODE lang="kotlin"&gt;import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import com.esri.arcgisruntime.mapping.ArcGISMap
import com.esri.arcgisruntime.mapping.Basemap
import kotlinx.android.synthetic.main.activity_main.*
import com.esri.arcgisruntime.data.ServiceGeodatabase
import com.esri.arcgisruntime.layers.FeatureLayer
import com.esri.arcgisruntime.loadable.LoadStatus

class MainActivity : AppCompatActivity() {

    // Keep ServiceGeodatabase as a field in the class so that it doesn't get
    // garbage collected while it is being loaded.
    private lateinit var mServiceGeodatabase: ServiceGeodatabase

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        mapView.map = ArcGISMap(Basemap.createDarkGrayCanvasVector())

        mServiceGeodatabase = ServiceGeodatabase(
            "https://services3.arcgis.com/df7XtT0Re4z8S561/arcgis/rest/services/Chimpanzee/FeatureServer"
        )
        // ServiceGeodatabase is a Loadable, so we must trigger its loading before we can use it.
        mServiceGeodatabase.loadAsync()
        mServiceGeodatabase.addDoneLoadingListener {
            if (mServiceGeodatabase.loadStatus != LoadStatus.LOADED) {
                mServiceGeodatabase.loadError?.let {
                    Log.e("Tag", "Service Geodatabase failed to load: ${it}, ${it.cause}")
                }
                return@addDoneLoadingListener
            }

            Log.i("Tag", "ServiceGeodatabase loaded")
            // Code for getting the table is now here inside the doneLoadingListener.
            val serviceFeatureTable = mServiceGeodatabase.getTable(0)
            val layer = FeatureLayer(serviceFeatureTable)
            mapView.map.operationalLayers.add(layer)
        }
        // Any code placed below the listener will most-likely happen _before_ the listener code
        // is executed, since the listener code waits for the Geodatabase to load -- it is asynchronous.
    }

    override fun onResume() {
        super.onResume()
        mapView.resume()
    }

    override fun onPause() {
        mapView.pause()
        super.onPause()
    }

    override fun onDestroy() {
        mapView.dispose()
        super.onDestroy()
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regarding branch versioning, I can direct you to this &lt;A href="https://developers.arcgis.com/android/kotlin/sample-code/edit-with-branch-versioning/" target="_self"&gt;Android sample&lt;/A&gt; which explains the process and gives an example.&lt;/P&gt;&lt;P&gt;I hope this helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 10:08:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/update-regarding-branching-and-versioning-of-maps/m-p/1088338#M5589</guid>
      <dc:creator>FinlayPearson</dc:creator>
      <dc:date>2021-08-12T10:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: Update regarding branching and versioning of maps</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/update-regarding-branching-and-versioning-of-maps/m-p/1088778#M5594</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/511475"&gt;@FinlayPearson&lt;/a&gt;&amp;nbsp;Thank you so much for helping with the detailed explanation. You guys are awesome in responding to queries.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Aug 2021 06:59:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/update-regarding-branching-and-versioning-of-maps/m-p/1088778#M5594</guid>
      <dc:creator>Latheesh</dc:creator>
      <dc:date>2021-08-13T06:59:13Z</dc:date>
    </item>
  </channel>
</rss>

