Address constantly changing xpath arrays


first of all I’m very new to appium and to Java as well. I want to test some basic Android features so I can’t rewrite any app because I’m really testing Android OS.

e.g. I want appium to get to Settings - Cloud and Accounts and then click on Accounts. So far so goo. I know that the App package is and the app activity is$CloudAccountSettingsActivity.
When I start the Inspection with Appium Desktop App I can click on Accounts and get the xpath (ID is not available) and the test is working perfectly whith this xpath BUT

sometimes the Android menu is changing based on some features of the device.

So now xpath is

but in case Samsung Cloud is missing the xpath is changing to


That means Android is using arrays for their menus which makes it (currently) impossible for me to automate some tests.
I tried to change the array to [@text=‘Accounts’] but this isn’t working.
I also tried to not use xpath but the resource-id as"…"); but it’s obviously not working.

Any other ideas? I currently can’t see the wood for the trees :confused: