How to get version details of native application under test both for Android and iOS

I have tried using Appium API method getAppStringMap() to get app version details per the Appium documentation but it is throwing below Exception when executed on real device in Perfecto cloud. Can you please help me how to get version details of application under test. Appreciate your inputs.

Platform: iOS and Android
java Client langauage: 6.1.0
pm-webdriver: 10.4
selenium: 2.48

Exception Trace:
Aug 01, 2019 3:21:53 PM io.appium.java_client.remote.AppiumCommandExecutor$1 lambda$0
INFO: Detected dialect: OSS
Exception in thread “main” org.openqa.selenium.WebDriverException: getAppStrings command is not supported
Command duration or timeout: 0 milliseconds
Build info: version: ‘3.13.0’, revision: ‘2f0d292’, time: ‘2018-06-25T15:24:21.231Z’
System info: host: ‘’, ip: ‘’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_212’
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities {appPackage: com.MyApp, assert_javascript_enabled: true, deviceName: R3JYHY, deviceSessionId: [email protected]…, entityType: appium_driver, executionId: [email protected]…, host: abc.perfectomobile.com, javascriptEnabled: true, password: , platform: ANDROID, platformName: Android, reportPdfUrl: https://abc.app.perfectomobi…, scriptName: RemoteWebDriver, securityToken: , serverConnector: , testGridReportUrl: https://abc.app.perfectomobi…, user: , webdriver.remote.sessionid: 989c0f81-b03f-4289-841c-5d7…}
Session ID: 989c0f81-b03f-4289-841c-5d7c00fc6a7c
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:231)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:46)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at io.appium.java_client.CommandExecutionHelper.execute(CommandExecutionHelper.java:31)
at io.appium.java_client.HasAppStrings.getAppStringMap(HasAppStrings.java:32)
at AppiumTest.main(AppiumTest.java:118)
Caused by: java.lang.UnsupportedOperationException: getAppStrings command is not supported
at com.perfectomobile.selenium.server.appium.GetAppStrings.mobileCall(GetAppStrings.java:26)
at com.perfectomobile.selenium.server.appium.GetAppStrings.mobileCall(GetAppStrings.java:14)
at com.perfectomobile.selenium.server.MobileWebDriverHandler.call(MobileWebDriverHandler.java:23)
at org.openqa.selenium.remote.server.handler.WebDriverHandler.handle(WebDriverHandler.java:41)
at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:125)
at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:200)
at org.openqa.selenium.remote.server.PerfectoMobileSession.execute(PerfectoMobileSession.java:65)
at org.openqa.selenium.remote.server.MobileWebDriverServlet.lambda$handle$2(MobileWebDriverServlet.java:298)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)

I would doubt anyone on this forum can help with this. According to the Perfecto website:

Perfecto has re-implemented the Appium server so it can deliver stronger automated testing controls, mimic real user environments, and support the unique needs of today’s Global 1000 companies.

https://www.perfecto.io/integrations/appium

Given that we don’t know the changes they’ve made to Appium, my best suggestion would be to contact them about this problem. If you are paying for the service they should offer support.

@wreed never say anyone :slight_smile:
@sunilkumar3996 we made in a way that we get version ourself. With android via abd command with iOS we unzip ipa and grab version from plist.

If it can work for you i can give details.

@Aleksei I stand corrected :wink:

Thanks for the suggestion @wreed. Have raised this query with Perfecto support and got reply "I have been investigating and have not found any articles from Appium that mention support for this on android past version 4.2. I am not sure that as Appium does not appear to have a function to collect this if Perfecto will be able to support it as we are using Appium API’s. The only way that I can suggest you locate this is if your application has an about section that lists the Application Version.

If you would like I can raise a feature request to see if we can support a method to collect the application version. However once again as there is no API for this that I can find with Appium the chances are unlikely that we will be able to create this.

I cannot help you with implementation of a method (i.e. getAppStringMap) that does not support an Android version over 4.2"

Reason to post this query here is, if Appium is not supporting getAppStringMap after Android version 4.2, then expected Appium API documentation would have been updated accordingly as the exception thrown is not informative. But as there is no information regarding support till android version 4.2 aynwhere in Appium site, thought of double checking the same with the group here.

Can you please help me how and where to use the method ‘getAppStringMap’ if it’s really working.

Thanks @Aleksei. Can you please review the adb command below and confirm are you referring to the same? If so, help me how to put that in Appium java-client method to get version app details as I’m not clear how to combine multiple commands and run through code after going through https://appiumpro.com/editions/3.

“shell dumpsys package | grep versionName”.

Also, please share the code snippet for iOS to perform the same.

@sunilkumar3996 for Android same.
for iOS:

unzip -d ipa -o nameOfBuild
"/usr/libexec/PlistBuddy -c print ipa/Payload/" + nameOfBuild.replaceAll(".ipa", ".app") +
                        "/Info.plist | grep CFBundleShortVersionString"

i just execute this code in any available way of terminal (tons ways in Java: https://www.mkyong.com/java/how-to-execute-shell-command-from-java/) and read output.

Thanks @Aleksei for the command to unzip but for Android I need to execute adb command on device connected in Perfecto cloud and that may not be achieved running the direct java code following the suggested site. Please correct me if I’m wrong.

@sunilkumar3996 Appium allows to execute remote adb command. For iOS of course unzip and following commands will not possible remotedly

Thanks a lot @Aleksei for the quick response and answers. Have tried with Appium and failed to run arbitrary commands on cloud due to the restrictions and may be for security reasons per the support teams update.

But I would like to know the usage of getAppStringMap method on latest OS. If it’s not working I don’t see the reason to maintain it unless Appium has plans to fix in next versions or to support OS versions less than 4.2 for Android.

I guess they closed in cloud all adb commands…

Regarding iOS you may enter ticket to see