title: How to get google play store app version using JSOUP?
body: <p>I am using below code to get <strong>versionName</strong> from Google play store by using Jsoup for fetching details but its throwing some exception, But recently it was working fine. I don't know what happen now?</p>
  
  <p>My code is - </p>
  
  <pre><code>public class VersionChecker extends AsyncTask&lt;String, String, String&gt; {
  
      private String newVersion;
  
      @Override
      protected String doInBackground(String... params) {
  
          try {
              newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=" + ParkwayApplication.getInstance().getPackageName() + "&amp;hl=en")
                      .timeout(30000)
                      .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6")
                      .referrer("http://www.google.com")
                      .get()
                      .select("div[itemprop=softwareVersion]")
                      .first()
                      .ownText();
              Log.d("otherhtml", newVersion);
          } catch (IOException e) {
              e.printStackTrace();
          }
  
          return newVersion;
      }
  }
  </code></pre>
  
  <p>Note - In above code the <strong>select()</strong> returns size 0 and when i call <strong>first()</strong> it will return null and that's why getting null pointer exception. </p>
  
  <p>Note - I don't have any idea why it was working recently why not working now?</p>
  
  <p>Here is the link I <a href="https://stackoverflow.com/questions/49316550/attempt-to-invoke-virtual-method-java-lang-string-org-jsoup-nodes-element-ownte?rq=1">tried</a> and <a href="https://stackoverflow.com/a/36509726/3448003">this</a> but no solution.</p>
  
  <p>This library version I am using now - </p>
  
  <pre><code>compile 'org.jsoup:jsoup:1.8.3'
  </code></pre>
  
  <p>But I tried latest one too - </p>
  
  <pre><code>compile 'org.jsoup:jsoup:1.11.3'
  </code></pre>
  
  <p>Below is exact error I am getting - </p>
  
  <pre><code>Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 
  'java.lang.String org.jsoup.nodes.Element.ownText()' on a null object reference 
     at com.ranosys.parkway.utils.VersionChecker.doInBackground(VersionChecker.java:31)
     at com.ranosys.parkway.utils.VersionChecker.doInBackground(VersionChecker.java:16)
     at android.os.AsyncTask$2.call(AsyncTask.java:295)
     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
     at java.lang.Thread.run(Thread.java:818) 
  </code></pre>