How to find app version with appium on iOS











up vote
0
down vote

favorite












When I launch my tests, I want a lots of debug informations : device used, operating system, and version of the app tested.



My problem is about the version of the app.



On Android, I use :



String line = "adb -s " + udid + " shell dumpsys package";
Runtime.getRuntime().exec(line);



After that, searching the package name and then the versionName is easy.



But how to find the same information on iOS ? I didn't find any documentation to have app informations. (and obviously, adb is not compatible with iphone)










share|improve this question






















  • Do You use Appium for automated testing?
    – Kovacic
    May 18 at 9:22










  • Yes, I use Appium for the test.
    – Fabrice31
    May 18 at 9:52















up vote
0
down vote

favorite












When I launch my tests, I want a lots of debug informations : device used, operating system, and version of the app tested.



My problem is about the version of the app.



On Android, I use :



String line = "adb -s " + udid + " shell dumpsys package";
Runtime.getRuntime().exec(line);



After that, searching the package name and then the versionName is easy.



But how to find the same information on iOS ? I didn't find any documentation to have app informations. (and obviously, adb is not compatible with iphone)










share|improve this question






















  • Do You use Appium for automated testing?
    – Kovacic
    May 18 at 9:22










  • Yes, I use Appium for the test.
    – Fabrice31
    May 18 at 9:52













up vote
0
down vote

favorite









up vote
0
down vote

favorite











When I launch my tests, I want a lots of debug informations : device used, operating system, and version of the app tested.



My problem is about the version of the app.



On Android, I use :



String line = "adb -s " + udid + " shell dumpsys package";
Runtime.getRuntime().exec(line);



After that, searching the package name and then the versionName is easy.



But how to find the same information on iOS ? I didn't find any documentation to have app informations. (and obviously, adb is not compatible with iphone)










share|improve this question













When I launch my tests, I want a lots of debug informations : device used, operating system, and version of the app tested.



My problem is about the version of the app.



On Android, I use :



String line = "adb -s " + udid + " shell dumpsys package";
Runtime.getRuntime().exec(line);



After that, searching the package name and then the versionName is easy.



But how to find the same information on iOS ? I didn't find any documentation to have app informations. (and obviously, adb is not compatible with iphone)







java ios automated-tests appium






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked May 18 at 9:16









Fabrice31

702723




702723












  • Do You use Appium for automated testing?
    – Kovacic
    May 18 at 9:22










  • Yes, I use Appium for the test.
    – Fabrice31
    May 18 at 9:52


















  • Do You use Appium for automated testing?
    – Kovacic
    May 18 at 9:22










  • Yes, I use Appium for the test.
    – Fabrice31
    May 18 at 9:52
















Do You use Appium for automated testing?
– Kovacic
May 18 at 9:22




Do You use Appium for automated testing?
– Kovacic
May 18 at 9:22












Yes, I use Appium for the test.
– Fabrice31
May 18 at 9:52




Yes, I use Appium for the test.
– Fabrice31
May 18 at 9:52












2 Answers
2






active

oldest

votes

















up vote
0
down vote













You can try this. If You're using *.app You can try with this comand:




or ipa "IPA/payload/NAME.app/Info.plist"




String line = "/usr/libexec/PlistBuddy -c print Downloads/Payload/NAME.app/Info.plist | grep CFBundleVersion"
Runtime.getRuntime().exec(line);





share|improve this answer




























    up vote
    0
    down vote













    TL;DR
    Check out this article for a summary.





    For iOS, you have the following options:




    1. Use a command line tool like defaults on Mac or plistutil on Linux and call it from within your Java code using ProcessBuilder.

    2. Use the dd-plist library for Java

    3. Use the justtestlah library for Java (which wraps dd-plist and a similar library for Android apps) Disclaimer: I'm the author of this tool.


    In short, if you only require iOS I suggest option 2, if you want the same approach for Android and iOS I recommend option 3.



    Ad 1.



    This is platform-dependent and therefore not ideal (IMO). If you are only targeting one platform to execute your tests from or don't mind maintaining multiple and also don't mind installing some additional tools this works fine though.



    These are the commands to retrieve the version information. Similarly, you can also query other metadata from the app packages.



    Mac OS:



    defaults read /path/test.app/Info CFBundleShortVersionString
    defaults read /path/test.app/Info CFBundleVersion


    Linux:



    plistutil -i /path/test.app/Info | xmllint --xpath "//key[text()='CFBundleShortVersionString']/following-sibling::string[1]/text()" -
    plistutil -i /path/test.app/Info | xmllint --xpath "//key[text()='CFBundleVersion']/following-sibling::string[1]/text()" -


    This approach is probably most useful for use in shell scripts (e.g. in a CI pipeline).



    Integrating it into a Java program will look something like this (please note that you might need to add some additional error handling if you decide to use this):



    String versionName = executeCommand("defaults read /path/test.app/Info CFBundleShortVersionString");

    public String executeCommand(String command) {
    LOG.info("Executing command {}", command);
    String shellCommand = {"/bin/sh", "-c", command};
    Process process;
    try {
    process = new ProcessBuilder(shellCommand).start();
    return Stream.of(process.getErrorStream(), process.getInputStream())
    .parallel()
    .map(
    (InputStream inputStream) -> {
    try (BufferedReader br = new BufferedReader(new InputStreamReader(inputStream))) {
    return br.readLine(); // we only care about the first line
    } catch (IOException e) {
    throw new RuntimeException(e);
    }
    })
    .collect(Collectors.joining());
    } catch (IOException exception) {
    LOG.error(String.format("Error while executing command %s", command), exception);
    }
    return "";
    }


    I did a PoC for this here. While this works fine and has the advantage of not needing any additional Java libraries, I would recommend one of the other options instead.



    Ad 2.



    Add the dd-list JAR file to your classpath. For example, for Maven:



    <properties>
    <dd.plist.version>1.21</dd.plist.version>
    </properties>

    <dependencies>
    <dependency>
    <groupId>com.googlecode.plist</groupId>
    <artifactId>dd-plist</artifactId>
    <version>${dd.plist.version}</version>
    </dependency>
    </depdencies>


    Then, run the code like this:



    String appPath = "/path/test.app";
    NSDictionary dictionary = (NSDictionary) PropertyListParser.parse(path);
    String versionName = dictionary.objectForKey(“CFBundleShortVersionString”).toString();
    String versionCode = dictionary.objectForKey(“CFBundleVersion”).toString();


    Ad 3.



    Add the justtestlah-mobile-tools JAR file to your classpath. For Maven:



    <properties>
    <justtestlah.version>1.3.2</justtestlah.version>
    </properties>
    <dependencies>
    <dependency>
    <groupId>io.github.martinschneider</groupId>
    <artifactId>justtestlah-mobile-tools</artifactId>
    <version>${justtestlah.version}</version>
    </dependency>
    </depdencies>


    Then run the code like this:



    ApplicationInfo appInfo = new ApplicationInfoService().getAppInfo(appPath);
    String versionName = appInfo.getVersionName();
    String versionCode = appInfo.getVersionCode();
    String applicationName = appInfo.getApplicationName();


    The added benefit of the last one is that you can use the same code for APK, APP and even IPA files.






    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














       

      draft saved


      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50407862%2fhow-to-find-app-version-with-appium-on-ios%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      0
      down vote













      You can try this. If You're using *.app You can try with this comand:




      or ipa "IPA/payload/NAME.app/Info.plist"




      String line = "/usr/libexec/PlistBuddy -c print Downloads/Payload/NAME.app/Info.plist | grep CFBundleVersion"
      Runtime.getRuntime().exec(line);





      share|improve this answer

























        up vote
        0
        down vote













        You can try this. If You're using *.app You can try with this comand:




        or ipa "IPA/payload/NAME.app/Info.plist"




        String line = "/usr/libexec/PlistBuddy -c print Downloads/Payload/NAME.app/Info.plist | grep CFBundleVersion"
        Runtime.getRuntime().exec(line);





        share|improve this answer























          up vote
          0
          down vote










          up vote
          0
          down vote









          You can try this. If You're using *.app You can try with this comand:




          or ipa "IPA/payload/NAME.app/Info.plist"




          String line = "/usr/libexec/PlistBuddy -c print Downloads/Payload/NAME.app/Info.plist | grep CFBundleVersion"
          Runtime.getRuntime().exec(line);





          share|improve this answer












          You can try this. If You're using *.app You can try with this comand:




          or ipa "IPA/payload/NAME.app/Info.plist"




          String line = "/usr/libexec/PlistBuddy -c print Downloads/Payload/NAME.app/Info.plist | grep CFBundleVersion"
          Runtime.getRuntime().exec(line);






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered May 18 at 11:06









          Kovacic

          997119




          997119
























              up vote
              0
              down vote













              TL;DR
              Check out this article for a summary.





              For iOS, you have the following options:




              1. Use a command line tool like defaults on Mac or plistutil on Linux and call it from within your Java code using ProcessBuilder.

              2. Use the dd-plist library for Java

              3. Use the justtestlah library for Java (which wraps dd-plist and a similar library for Android apps) Disclaimer: I'm the author of this tool.


              In short, if you only require iOS I suggest option 2, if you want the same approach for Android and iOS I recommend option 3.



              Ad 1.



              This is platform-dependent and therefore not ideal (IMO). If you are only targeting one platform to execute your tests from or don't mind maintaining multiple and also don't mind installing some additional tools this works fine though.



              These are the commands to retrieve the version information. Similarly, you can also query other metadata from the app packages.



              Mac OS:



              defaults read /path/test.app/Info CFBundleShortVersionString
              defaults read /path/test.app/Info CFBundleVersion


              Linux:



              plistutil -i /path/test.app/Info | xmllint --xpath "//key[text()='CFBundleShortVersionString']/following-sibling::string[1]/text()" -
              plistutil -i /path/test.app/Info | xmllint --xpath "//key[text()='CFBundleVersion']/following-sibling::string[1]/text()" -


              This approach is probably most useful for use in shell scripts (e.g. in a CI pipeline).



              Integrating it into a Java program will look something like this (please note that you might need to add some additional error handling if you decide to use this):



              String versionName = executeCommand("defaults read /path/test.app/Info CFBundleShortVersionString");

              public String executeCommand(String command) {
              LOG.info("Executing command {}", command);
              String shellCommand = {"/bin/sh", "-c", command};
              Process process;
              try {
              process = new ProcessBuilder(shellCommand).start();
              return Stream.of(process.getErrorStream(), process.getInputStream())
              .parallel()
              .map(
              (InputStream inputStream) -> {
              try (BufferedReader br = new BufferedReader(new InputStreamReader(inputStream))) {
              return br.readLine(); // we only care about the first line
              } catch (IOException e) {
              throw new RuntimeException(e);
              }
              })
              .collect(Collectors.joining());
              } catch (IOException exception) {
              LOG.error(String.format("Error while executing command %s", command), exception);
              }
              return "";
              }


              I did a PoC for this here. While this works fine and has the advantage of not needing any additional Java libraries, I would recommend one of the other options instead.



              Ad 2.



              Add the dd-list JAR file to your classpath. For example, for Maven:



              <properties>
              <dd.plist.version>1.21</dd.plist.version>
              </properties>

              <dependencies>
              <dependency>
              <groupId>com.googlecode.plist</groupId>
              <artifactId>dd-plist</artifactId>
              <version>${dd.plist.version}</version>
              </dependency>
              </depdencies>


              Then, run the code like this:



              String appPath = "/path/test.app";
              NSDictionary dictionary = (NSDictionary) PropertyListParser.parse(path);
              String versionName = dictionary.objectForKey(“CFBundleShortVersionString”).toString();
              String versionCode = dictionary.objectForKey(“CFBundleVersion”).toString();


              Ad 3.



              Add the justtestlah-mobile-tools JAR file to your classpath. For Maven:



              <properties>
              <justtestlah.version>1.3.2</justtestlah.version>
              </properties>
              <dependencies>
              <dependency>
              <groupId>io.github.martinschneider</groupId>
              <artifactId>justtestlah-mobile-tools</artifactId>
              <version>${justtestlah.version}</version>
              </dependency>
              </depdencies>


              Then run the code like this:



              ApplicationInfo appInfo = new ApplicationInfoService().getAppInfo(appPath);
              String versionName = appInfo.getVersionName();
              String versionCode = appInfo.getVersionCode();
              String applicationName = appInfo.getApplicationName();


              The added benefit of the last one is that you can use the same code for APK, APP and even IPA files.






              share|improve this answer



























                up vote
                0
                down vote













                TL;DR
                Check out this article for a summary.





                For iOS, you have the following options:




                1. Use a command line tool like defaults on Mac or plistutil on Linux and call it from within your Java code using ProcessBuilder.

                2. Use the dd-plist library for Java

                3. Use the justtestlah library for Java (which wraps dd-plist and a similar library for Android apps) Disclaimer: I'm the author of this tool.


                In short, if you only require iOS I suggest option 2, if you want the same approach for Android and iOS I recommend option 3.



                Ad 1.



                This is platform-dependent and therefore not ideal (IMO). If you are only targeting one platform to execute your tests from or don't mind maintaining multiple and also don't mind installing some additional tools this works fine though.



                These are the commands to retrieve the version information. Similarly, you can also query other metadata from the app packages.



                Mac OS:



                defaults read /path/test.app/Info CFBundleShortVersionString
                defaults read /path/test.app/Info CFBundleVersion


                Linux:



                plistutil -i /path/test.app/Info | xmllint --xpath "//key[text()='CFBundleShortVersionString']/following-sibling::string[1]/text()" -
                plistutil -i /path/test.app/Info | xmllint --xpath "//key[text()='CFBundleVersion']/following-sibling::string[1]/text()" -


                This approach is probably most useful for use in shell scripts (e.g. in a CI pipeline).



                Integrating it into a Java program will look something like this (please note that you might need to add some additional error handling if you decide to use this):



                String versionName = executeCommand("defaults read /path/test.app/Info CFBundleShortVersionString");

                public String executeCommand(String command) {
                LOG.info("Executing command {}", command);
                String shellCommand = {"/bin/sh", "-c", command};
                Process process;
                try {
                process = new ProcessBuilder(shellCommand).start();
                return Stream.of(process.getErrorStream(), process.getInputStream())
                .parallel()
                .map(
                (InputStream inputStream) -> {
                try (BufferedReader br = new BufferedReader(new InputStreamReader(inputStream))) {
                return br.readLine(); // we only care about the first line
                } catch (IOException e) {
                throw new RuntimeException(e);
                }
                })
                .collect(Collectors.joining());
                } catch (IOException exception) {
                LOG.error(String.format("Error while executing command %s", command), exception);
                }
                return "";
                }


                I did a PoC for this here. While this works fine and has the advantage of not needing any additional Java libraries, I would recommend one of the other options instead.



                Ad 2.



                Add the dd-list JAR file to your classpath. For example, for Maven:



                <properties>
                <dd.plist.version>1.21</dd.plist.version>
                </properties>

                <dependencies>
                <dependency>
                <groupId>com.googlecode.plist</groupId>
                <artifactId>dd-plist</artifactId>
                <version>${dd.plist.version}</version>
                </dependency>
                </depdencies>


                Then, run the code like this:



                String appPath = "/path/test.app";
                NSDictionary dictionary = (NSDictionary) PropertyListParser.parse(path);
                String versionName = dictionary.objectForKey(“CFBundleShortVersionString”).toString();
                String versionCode = dictionary.objectForKey(“CFBundleVersion”).toString();


                Ad 3.



                Add the justtestlah-mobile-tools JAR file to your classpath. For Maven:



                <properties>
                <justtestlah.version>1.3.2</justtestlah.version>
                </properties>
                <dependencies>
                <dependency>
                <groupId>io.github.martinschneider</groupId>
                <artifactId>justtestlah-mobile-tools</artifactId>
                <version>${justtestlah.version}</version>
                </dependency>
                </depdencies>


                Then run the code like this:



                ApplicationInfo appInfo = new ApplicationInfoService().getAppInfo(appPath);
                String versionName = appInfo.getVersionName();
                String versionCode = appInfo.getVersionCode();
                String applicationName = appInfo.getApplicationName();


                The added benefit of the last one is that you can use the same code for APK, APP and even IPA files.






                share|improve this answer

























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  TL;DR
                  Check out this article for a summary.





                  For iOS, you have the following options:




                  1. Use a command line tool like defaults on Mac or plistutil on Linux and call it from within your Java code using ProcessBuilder.

                  2. Use the dd-plist library for Java

                  3. Use the justtestlah library for Java (which wraps dd-plist and a similar library for Android apps) Disclaimer: I'm the author of this tool.


                  In short, if you only require iOS I suggest option 2, if you want the same approach for Android and iOS I recommend option 3.



                  Ad 1.



                  This is platform-dependent and therefore not ideal (IMO). If you are only targeting one platform to execute your tests from or don't mind maintaining multiple and also don't mind installing some additional tools this works fine though.



                  These are the commands to retrieve the version information. Similarly, you can also query other metadata from the app packages.



                  Mac OS:



                  defaults read /path/test.app/Info CFBundleShortVersionString
                  defaults read /path/test.app/Info CFBundleVersion


                  Linux:



                  plistutil -i /path/test.app/Info | xmllint --xpath "//key[text()='CFBundleShortVersionString']/following-sibling::string[1]/text()" -
                  plistutil -i /path/test.app/Info | xmllint --xpath "//key[text()='CFBundleVersion']/following-sibling::string[1]/text()" -


                  This approach is probably most useful for use in shell scripts (e.g. in a CI pipeline).



                  Integrating it into a Java program will look something like this (please note that you might need to add some additional error handling if you decide to use this):



                  String versionName = executeCommand("defaults read /path/test.app/Info CFBundleShortVersionString");

                  public String executeCommand(String command) {
                  LOG.info("Executing command {}", command);
                  String shellCommand = {"/bin/sh", "-c", command};
                  Process process;
                  try {
                  process = new ProcessBuilder(shellCommand).start();
                  return Stream.of(process.getErrorStream(), process.getInputStream())
                  .parallel()
                  .map(
                  (InputStream inputStream) -> {
                  try (BufferedReader br = new BufferedReader(new InputStreamReader(inputStream))) {
                  return br.readLine(); // we only care about the first line
                  } catch (IOException e) {
                  throw new RuntimeException(e);
                  }
                  })
                  .collect(Collectors.joining());
                  } catch (IOException exception) {
                  LOG.error(String.format("Error while executing command %s", command), exception);
                  }
                  return "";
                  }


                  I did a PoC for this here. While this works fine and has the advantage of not needing any additional Java libraries, I would recommend one of the other options instead.



                  Ad 2.



                  Add the dd-list JAR file to your classpath. For example, for Maven:



                  <properties>
                  <dd.plist.version>1.21</dd.plist.version>
                  </properties>

                  <dependencies>
                  <dependency>
                  <groupId>com.googlecode.plist</groupId>
                  <artifactId>dd-plist</artifactId>
                  <version>${dd.plist.version}</version>
                  </dependency>
                  </depdencies>


                  Then, run the code like this:



                  String appPath = "/path/test.app";
                  NSDictionary dictionary = (NSDictionary) PropertyListParser.parse(path);
                  String versionName = dictionary.objectForKey(“CFBundleShortVersionString”).toString();
                  String versionCode = dictionary.objectForKey(“CFBundleVersion”).toString();


                  Ad 3.



                  Add the justtestlah-mobile-tools JAR file to your classpath. For Maven:



                  <properties>
                  <justtestlah.version>1.3.2</justtestlah.version>
                  </properties>
                  <dependencies>
                  <dependency>
                  <groupId>io.github.martinschneider</groupId>
                  <artifactId>justtestlah-mobile-tools</artifactId>
                  <version>${justtestlah.version}</version>
                  </dependency>
                  </depdencies>


                  Then run the code like this:



                  ApplicationInfo appInfo = new ApplicationInfoService().getAppInfo(appPath);
                  String versionName = appInfo.getVersionName();
                  String versionCode = appInfo.getVersionCode();
                  String applicationName = appInfo.getApplicationName();


                  The added benefit of the last one is that you can use the same code for APK, APP and even IPA files.






                  share|improve this answer














                  TL;DR
                  Check out this article for a summary.





                  For iOS, you have the following options:




                  1. Use a command line tool like defaults on Mac or plistutil on Linux and call it from within your Java code using ProcessBuilder.

                  2. Use the dd-plist library for Java

                  3. Use the justtestlah library for Java (which wraps dd-plist and a similar library for Android apps) Disclaimer: I'm the author of this tool.


                  In short, if you only require iOS I suggest option 2, if you want the same approach for Android and iOS I recommend option 3.



                  Ad 1.



                  This is platform-dependent and therefore not ideal (IMO). If you are only targeting one platform to execute your tests from or don't mind maintaining multiple and also don't mind installing some additional tools this works fine though.



                  These are the commands to retrieve the version information. Similarly, you can also query other metadata from the app packages.



                  Mac OS:



                  defaults read /path/test.app/Info CFBundleShortVersionString
                  defaults read /path/test.app/Info CFBundleVersion


                  Linux:



                  plistutil -i /path/test.app/Info | xmllint --xpath "//key[text()='CFBundleShortVersionString']/following-sibling::string[1]/text()" -
                  plistutil -i /path/test.app/Info | xmllint --xpath "//key[text()='CFBundleVersion']/following-sibling::string[1]/text()" -


                  This approach is probably most useful for use in shell scripts (e.g. in a CI pipeline).



                  Integrating it into a Java program will look something like this (please note that you might need to add some additional error handling if you decide to use this):



                  String versionName = executeCommand("defaults read /path/test.app/Info CFBundleShortVersionString");

                  public String executeCommand(String command) {
                  LOG.info("Executing command {}", command);
                  String shellCommand = {"/bin/sh", "-c", command};
                  Process process;
                  try {
                  process = new ProcessBuilder(shellCommand).start();
                  return Stream.of(process.getErrorStream(), process.getInputStream())
                  .parallel()
                  .map(
                  (InputStream inputStream) -> {
                  try (BufferedReader br = new BufferedReader(new InputStreamReader(inputStream))) {
                  return br.readLine(); // we only care about the first line
                  } catch (IOException e) {
                  throw new RuntimeException(e);
                  }
                  })
                  .collect(Collectors.joining());
                  } catch (IOException exception) {
                  LOG.error(String.format("Error while executing command %s", command), exception);
                  }
                  return "";
                  }


                  I did a PoC for this here. While this works fine and has the advantage of not needing any additional Java libraries, I would recommend one of the other options instead.



                  Ad 2.



                  Add the dd-list JAR file to your classpath. For example, for Maven:



                  <properties>
                  <dd.plist.version>1.21</dd.plist.version>
                  </properties>

                  <dependencies>
                  <dependency>
                  <groupId>com.googlecode.plist</groupId>
                  <artifactId>dd-plist</artifactId>
                  <version>${dd.plist.version}</version>
                  </dependency>
                  </depdencies>


                  Then, run the code like this:



                  String appPath = "/path/test.app";
                  NSDictionary dictionary = (NSDictionary) PropertyListParser.parse(path);
                  String versionName = dictionary.objectForKey(“CFBundleShortVersionString”).toString();
                  String versionCode = dictionary.objectForKey(“CFBundleVersion”).toString();


                  Ad 3.



                  Add the justtestlah-mobile-tools JAR file to your classpath. For Maven:



                  <properties>
                  <justtestlah.version>1.3.2</justtestlah.version>
                  </properties>
                  <dependencies>
                  <dependency>
                  <groupId>io.github.martinschneider</groupId>
                  <artifactId>justtestlah-mobile-tools</artifactId>
                  <version>${justtestlah.version}</version>
                  </dependency>
                  </depdencies>


                  Then run the code like this:



                  ApplicationInfo appInfo = new ApplicationInfoService().getAppInfo(appPath);
                  String versionName = appInfo.getVersionName();
                  String versionCode = appInfo.getVersionCode();
                  String applicationName = appInfo.getApplicationName();


                  The added benefit of the last one is that you can use the same code for APK, APP and even IPA files.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 2 days ago

























                  answered 2 days ago









                  martin

                  1,07711933




                  1,07711933






























                       

                      draft saved


                      draft discarded



















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50407862%2fhow-to-find-app-version-with-appium-on-ios%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      404 Error Contact Form 7 ajax form submitting

                      How to know if a Active Directory user can login interactively

                      TypeError: fit_transform() missing 1 required positional argument: 'X'