title: Android Studio: How to solve "Could not find class 'android.graphics.drawable.RippleDrawable' " in API 17?
body: <p>I am trying to retrieve <code>JSON</code> values from Thingspeak to send to my mobile app. I am just doing a test app for the time being so I have put a <code>TextView</code> so that one retrieved value from Thingspeak could be set in it. </p>
  
  <p>I am getting the following errors and no value is appearing on the screen of my app. My device uses <code>API 17</code> and I know that <code>RippleDrawable</code> was added as from <code>API 21</code> but I have tried various solutions proposed for this kind of error(adding the latest Support Library which matches the SDK, changing <code>Vector</code> to Selector in <code>drawable</code>) but none of them worked so I cannot figure out the problem is in my codes or the fact my device uses <code>API 17</code>. Either way, please provide me with some fixes.</p>
  
  <p>Logcat:</p>
  
  <pre><code>   12-11 13:46:44.122 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.view.Window$Callback.onPointerCaptureChanged, referenced from method android.support.v7.view.WindowCallbackWrapper.onPointerCaptureChanged
      12-11 13:46:44.122 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve interface method 15988: Landroid/view/Window$Callback;.onPointerCaptureChanged (Z)V
      12-11 13:46:44.122 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
      12-11 13:46:44.122 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.view.Window$Callback.onProvideKeyboardShortcuts, referenced from method android.support.v7.view.WindowCallbackWrapper.onProvideKeyboardShortcuts
      12-11 13:46:44.122 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve interface method 15990: Landroid/view/Window$Callback;.onProvideKeyboardShortcuts (Ljava/util/List;Landroid/view/Menu;I)V
      12-11 13:46:44.122 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
      12-11 13:46:44.122 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
      12-11 13:46:44.122 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested
      12-11 13:46:44.122 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve interface method 15992: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
      12-11 13:46:44.122 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
      12-11 13:46:44.122 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode
      12-11 13:46:44.122 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve interface method 15996: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
      12-11 13:46:44.122 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
      12-11 13:46:44.122 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.widget.TintTypedArray.getChangingConfigurations
      12-11 13:46:44.122 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 704: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
      12-11 13:46:44.122 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
      12-11 13:46:44.152 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.widget.TintTypedArray.getType
      12-11 13:46:44.152 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 726: Landroid/content/res/TypedArray;.getType (I)I
      12-11 13:46:44.152 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6e at 0x0008
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.content.Context.createDeviceProtectedStorageContext, referenced from method android.support.v4.content.ContextCompat.createDeviceProtectedStorageContext
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 485: Landroid/content/Context;.createDeviceProtectedStorageContext ()Landroid/content/Context;
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.content.Context.getCodeCacheDir, referenced from method android.support.v4.content.ContextCompat.getCodeCacheDir
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 491: Landroid/content/Context;.getCodeCacheDir ()Ljava/io/File;
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.content.Context.getColor, referenced from method android.support.v4.content.ContextCompat.getColor
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 492: Landroid/content/Context;.getColor (I)I
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.content.Context.getColorStateList, referenced from method android.support.v4.content.ContextCompat.getColorStateList
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 493: Landroid/content/Context;.getColorStateList (I)Landroid/content/res/ColorStateList;
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.content.Context.getDataDir, referenced from method android.support.v4.content.ContextCompat.getDataDir
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 495: Landroid/content/Context;.getDataDir ()Ljava/io/File;
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.content.Context.getDrawable, referenced from method android.support.v4.content.ContextCompat.getDrawable
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 496: Landroid/content/Context;.getDrawable (I)Landroid/graphics/drawable/Drawable;
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.content.Context.getExternalCacheDirs, referenced from method android.support.v4.content.ContextCompat.getExternalCacheDirs
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 498: Landroid/content/Context;.getExternalCacheDirs ()[Ljava/io/File;
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.content.Context.getExternalFilesDirs, referenced from method android.support.v4.content.ContextCompat.getExternalFilesDirs
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 500: Landroid/content/Context;.getExternalFilesDirs (Ljava/lang/String;)[Ljava/io/File;
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.content.Context.getNoBackupFilesDir, referenced from method android.support.v4.content.ContextCompat.getNoBackupFilesDir
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 503: Landroid/content/Context;.getNoBackupFilesDir ()Ljava/io/File;
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.content.Context.getObbDirs, referenced from method android.support.v4.content.ContextCompat.getObbDirs
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 505: Landroid/content/Context;.getObbDirs ()[Ljava/io/File;
      12-11 13:46:44.192 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
      12-11 13:46:44.202 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.content.Context.isDeviceProtectedStorage, referenced from method android.support.v4.content.ContextCompat.isDeviceProtectedStorage
      12-11 13:46:44.202 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 516: Landroid/content/Context;.isDeviceProtectedStorage ()Z
      12-11 13:46:44.202 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
      12-11 13:46:44.202 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.content.Context.startForegroundService, referenced from method android.support.v4.content.ContextCompat.startForegroundService
      12-11 13:46:44.202 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 531: Landroid/content/Context;.startForegroundService (Landroid/content/Intent;)Landroid/content/ComponentName;
      12-11 13:46:44.202 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
      12-11 13:46:44.442 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.widget.FrameLayout.startActionModeForChild, referenced from method android.support.v7.widget.ActionBarContainer.startActionModeForChild
      12-11 13:46:44.442 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 16457: Landroid/widget/FrameLayout;.startActionModeForChild (Landroid/view/View;Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
      12-11 13:46:44.442 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6f at 0x0002
      12-11 13:46:44.462 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.content.Context.getColorStateList, referenced from method android.support.v7.content.res.AppCompatResources.getColorStateList
      12-11 13:46:44.462 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 493: Landroid/content/Context;.getColorStateList (I)Landroid/content/res/ColorStateList;
      12-11 13:46:44.462 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
      12-11 13:46:44.492 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/graphics/drawable/Icon;)
      12-11 13:46:44.492 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.widget.ImageButton.setImageIcon, referenced from method android.support.v7.widget.AppCompatImageButton.setImageIcon
      12-11 13:46:44.492 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 16480: Landroid/widget/ImageButton;.setImageIcon (Landroid/graphics/drawable/Icon;)V
      12-11 13:46:44.492 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6f at 0x0000
      12-11 13:46:44.492 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.content.res.Resources.getDrawable, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawable
      12-11 13:46:44.492 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 667: Landroid/content/res/Resources;.getDrawable (ILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
      12-11 13:46:44.492 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
      12-11 13:46:44.492 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.content.res.Resources.getDrawableForDensity, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawableForDensity
      12-11 13:46:44.492 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 669: Landroid/content/res/Resources;.getDrawableForDensity (IILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
      12-11 13:46:44.492 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
      12-11 13:46:44.532 12483-12483/com.example.teerna.testapp E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering
      12-11 13:46:44.532 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve instanceof 193 (Landroid/graphics/drawable/RippleDrawable;) in Landroid/support/v7/widget/AppCompatImageHelper;
      12-11 13:46:44.532 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x20 at 0x000c
      12-11 13:46:44.632 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.widget.TextView.getAutoSizeMaxTextSize, referenced from method android.support.v7.widget.AppCompatTextView.getAutoSizeMaxTextSize
      12-11 13:46:44.632 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 16776: Landroid/widget/TextView;.getAutoSizeMaxTextSize ()I
      12-11 13:46:44.632 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6f at 0x0006
      12-11 13:46:44.632 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.widget.TextView.getAutoSizeMinTextSize, referenced from method android.support.v7.widget.AppCompatTextView.getAutoSizeMinTextSize
      12-11 13:46:44.632 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 16777: Landroid/widget/TextView;.getAutoSizeMinTextSize ()I
      12-11 13:46:44.632 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6f at 0x0006
      12-11 13:46:44.632 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.widget.TextView.getAutoSizeStepGranularity, referenced from method android.support.v7.widget.AppCompatTextView.getAutoSizeStepGranularity
      12-11 13:46:44.632 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 16778: Landroid/widget/TextView;.getAutoSizeStepGranularity ()I
      12-11 13:46:44.632 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6f at 0x0006
      12-11 13:46:44.632 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.widget.TextView.getAutoSizeTextAvailableSizes, referenced from method android.support.v7.widget.AppCompatTextView.getAutoSizeTextAvailableSizes
      12-11 13:46:44.632 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 16779: Landroid/widget/TextView;.getAutoSizeTextAvailableSizes ()[I
      12-11 13:46:44.632 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6f at 0x0006
      12-11 13:46:44.632 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.widget.TextView.getAutoSizeTextType, referenced from method android.support.v7.widget.AppCompatTextView.getAutoSizeTextType
      12-11 13:46:44.632 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 16780: Landroid/widget/TextView;.getAutoSizeTextType ()I
      12-11 13:46:44.632 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6f at 0x0008
      12-11 13:46:44.632 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.widget.TextView.setAutoSizeTextTypeUniformWithConfiguration, referenced from method android.support.v7.widget.AppCompatTextView.setAutoSizeTextTypeUniformWithConfiguration
      12-11 13:46:44.632 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 16823: Landroid/widget/TextView;.setAutoSizeTextTypeUniformWithConfiguration (IIII)V
      12-11 13:46:44.632 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6f at 0x0006
      12-11 13:46:44.632 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.widget.TextView.setAutoSizeTextTypeUniformWithPresetSizes, referenced from method android.support.v7.widget.AppCompatTextView.setAutoSizeTextTypeUniformWithPresetSizes
      12-11 13:46:44.632 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 16824: Landroid/widget/TextView;.setAutoSizeTextTypeUniformWithPresetSizes ([II)V
      12-11 13:46:44.632 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6f at 0x0006
      12-11 13:46:44.632 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.widget.TextView.setAutoSizeTextTypeWithDefaults, referenced from method android.support.v7.widget.AppCompatTextView.setAutoSizeTextTypeWithDefaults
      12-11 13:46:44.632 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 16825: Landroid/widget/TextView;.setAutoSizeTextTypeWithDefaults (I)V
      12-11 13:46:44.632 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6f at 0x0006
      12-11 13:46:44.742 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.widget.TextView.getAutoSizeStepGranularity, referenced from method android.support.v7.widget.AppCompatTextHelper.loadFromAttributes
      12-11 13:46:44.742 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 16778: Landroid/widget/TextView;.getAutoSizeStepGranularity ()I
      12-11 13:46:44.742 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6e at 0x0197
      12-11 13:46:44.742 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.text.StaticLayout$Builder.obtain, referenced from method android.support.v7.widget.AppCompatTextViewAutoSizeHelper.createStaticLayoutForMeasuring
      12-11 13:46:44.742 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve static method 15266: Landroid/text/StaticLayout$Builder;.obtain (Ljava/lang/CharSequence;IILandroid/text/TextPaint;I)Landroid/text/StaticLayout$Builder;
      12-11 13:46:44.742 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x71 at 0x0014
      12-11 13:46:44.742 12483-12483/com.example.teerna.testapp I/dalvikvm: Could not find method android.widget.TextView.isInLayout, referenced from method android.support.v7.widget.AppCompatTextViewAutoSizeHelper.setRawTextSize
      12-11 13:46:44.742 12483-12483/com.example.teerna.testapp W/dalvikvm: VFY: unable to resolve virtual method 16815: Landroid/widget/TextView;.isInLayout ()Z
      12-11 13:46:44.742 12483-12483/com.example.teerna.testapp D/dalvikvm: VFY: replacing opcode 0x6e at 0x0021
      12-11 13:46:45.053 12483-12483/com.example.teerna.testapp D/libEGL: loaded /system/lib/egl/libGLES_java.so
  </code></pre>
  
  <p>activity_main.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context="com.example.teerna.testapp.MainActivity"&gt;
  
  &lt;TextView
      android:id="@+id/aTextView"
      android:layout_width="100dp"
      android:layout_height="wrap_content"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintLeft_toLeftOf="parent"
      app:layout_constraintRight_toRightOf="parent"
      app:layout_constraintTop_toTopOf="parent" /&gt;
  
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>
  
  <p>MainActivity.java</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
   TextView tv;
  
  @Override
   protected void onCreate(Bundle savedInstanceState) {
      tv =(TextView)findViewById(R.id.aTextView);
      super.onCreate(savedInstanceState);
      new GetMethodDemo().execute("https://api.thingspeak.com/channels/357670/feeds.json?results=2");
      setContentView(R.layout.activity_main);
  
  }
  
  public class GetMethodDemo extends AsyncTask&lt;String , Void ,String&gt; {
      String server_response;
  
  
  
      @Override
      protected String doInBackground(String... strings) {
  
          URL url;
          HttpURLConnection urlConnection = null;
  
          try {
              url = new URL(strings[0]);
              urlConnection = (HttpURLConnection) url.openConnection();
  
              int responseCode = urlConnection.getResponseCode();
  
              if(responseCode == HttpURLConnection.HTTP_OK){
                  server_response = readStream(urlConnection.getInputStream());
                  Log.v("CatalogClient", server_response);
              }
  
          } catch (MalformedURLException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
  
          return null;
      }
  
      // Converting InputStream to String
      private String readStream(InputStream in) {
          BufferedReader reader = null;
          StringBuffer response = new StringBuffer();
            try {
              reader = new BufferedReader(new InputStreamReader(in, "UTF-8"));
              String line = "";
              while ((line = reader.readLine()) != null) {
                  response.append(line);
              }
          }   catch (IOException e) {
              e.printStackTrace();
          }   finally {
              if (reader != null) {
                  try {
                      reader.close();
                  }   catch (IOException e) {
                      e.printStackTrace();
                  }
              }
          }
          return response.toString();
      }
  
      @Override
      protected void onPostExecute(String response) {
          super.onPostExecute(response);
  
          if (response != null) {
              String item=null;
              try {
                  JSONObject json = new JSONObject(response);
                  JSONObject jsonResponse = json.getJSONObject("Response");
  
                  //Pulling items from array
                  item = jsonResponse.getString("ID");
  
              } catch (JSONException j) {
                  j.printStackTrace();
              }
  
              Log.e("Response", "" + server_response);
              tv.setText(String.valueOf(item));
              }
  
         }
      }
  }
  </code></pre>
  
  <p>AndroidManifest.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.teerna.testapp"&gt;
     &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  
  &lt;application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:supportsRtl="true"
      android:theme="@style/AppTheme"&gt;
      &lt;activity android:name=".MainActivity"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
  
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
    &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>