title: Android Error inflating class pl.droidsonroids.gif.GifImageView
body: <p>I am using android studio to run my project and it runs properly in devices with android version 5.1 but it crashes in devices with android version 4.4.4 and i searched a lot but i didn't find any solutions for my problem.any help please.</p>
  
  <p><strong><em>Stack Trace:</em></strong></p>
  
  <pre><code>java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mmido.asfarandroid/com.example.mmido.trivelgob2b.TrivelgoB2B.MainActivity}: android.view.InflateException: Binary XML file line #9: Error inflating class pl.droidsonroids.gif.GifImageView 
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2385)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2436)
  at android.app.ActivityThread.access$800(ActivityThread.java:157)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1374)
  at android.os.Handler.dispatchMessage(Handler.java:110)
  at android.os.Looper.loop(Looper.java:193)
  at android.app.ActivityThread.main(ActivityThread.java:5398)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:515)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:940)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
  at dalvik.system.NativeStart.main(Native Method)
  Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class pl.droidsonroids.gif.GifImageView
  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:707)
  at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
  at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)
  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
  at com.example.mmido.trivelgob2b.TrivelgoB2B.MainActivity.onCreate(MainActivity.java:52)
  at android.app.Activity.performCreate(Activity.java:5264)
  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2349)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2436) 
  at android.app.ActivityThread.access$800(ActivityThread.java:157) 
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1374) 
  at android.os.Handler.dispatchMessage(Handler.java:110) 
  at android.os.Looper.loop(Looper.java:193) 
  at android.app.ActivityThread.main(ActivityThread.java:5398) 
  at java.lang.reflect.Method.invokeNative(Native Method) 
  at java.lang.reflect.Method.invoke(Method.java:515) 
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:940) 
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756) 
  at dalvik.system.NativeStart.main(Native Method) 
  Caused by: java.lang.ClassNotFoundException: Didn't find class "pl.droidsonroids.gif.GifImageView" on path: DexPathList[[zip file "/data/app/com.example.mmido.asfarandroid-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.mmido.asfarandroid-2, /vendor/lib, /system/lib]]
  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
  at android.view.LayoutInflater.createView(LayoutInflater.java:559)
  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
  at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
  at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
  at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
  at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
  at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280) 
  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
  at com.example.mmido.trivelgob2b.TrivelgoB2B.MainActivity.onCreate(MainActivity.java:52) 
  at android.app.Activity.performCreate(Activity.java:5264) 
  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088) 
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2349) 
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2436) 
  at android.app.ActivityThread.access$800(ActivityThread.java:157) 
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1374) 
  at android.os.Handler.dispatchMessage(Handler.java:110) 
  at android.os.Looper.loop(Looper.java:193) 
  t android.app.ActivityThread.main(ActivityThread.java:5398) 
  at java.lang.reflect.Method.invokeNative(Native Method) 
  at java.lang.reflect.Method.invoke(Method.java:515) 
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:940) 
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756) 
  at dalvik.system.NativeStart.main(Native Method)  
  </code></pre>
  
  <p><strong><em>This is my Java Code</em></strong> </p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
      GifImageView gifImageView;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          gifImageView = (GifImageView) findViewById(R.id.gifview);
          try {
              GifDrawable gifDrawable = new GifDrawable(getResources(), R.drawable.comp_1);
              gifImageView.setImageDrawable(gifDrawable);
          } catch (Resources.NotFoundException e) {
  
              e.printStackTrace();
          } catch (IOException e) {
  
              e.printStackTrace();
          }
  
  
      }
  }
  </code></pre>
  
  <p><strong><em>Gradle:</em></strong></p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 23
      buildToolsVersion "23.0.3"
  
      defaultConfig {
          applicationId "com.example.mmido.asfarandroid"
          minSdkVersion 14
          targetSdkVersion 23
          versionCode 1
          versionName "1.0"
          multiDexEnabled true
      }
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_7
          targetCompatibility JavaVersion.VERSION_1_7
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      compile fileTree(include: ['*.jar'], dir: 'libs')
      compile 'com.android.support:appcompat-v7:23.1.1'
      compile 'com.android.support:design:23.2.1'
      compile 'com.android.support:multidex:1.0.0'
      compile 'cz.msebera.android:httpclient:4.4.1.1'
      compile 'cz.msebera.android:httpclient:4.4.1.1'
      testCompile 'junit:junit:4.12'
      compile 'com.google.code.gson:gson:2.2.2'
      compile fileTree(include: ['*.jar'], dir: 'libs')
      compile fileTree(dir: 'libs', include: ['*.jar'])
      testCompile 'junit:junit:4.12'
      compile 'com.android.support:appcompat-v7:23.3.0'
      compile 'com.amazonaws:aws-android-sdk-core:2.+'
      compile 'com.amazonaws:aws-android-sdk-cognito:2.+'
      compile 'com.amazonaws:aws-android-sdk-s3:2.+'
      compile 'com.amazonaws:aws-android-sdk-ddb:2.+'
      compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.16'
      compile 'cn.pedant.sweetalert:library:1.3'
      compile 'com.android.support:recyclerview-v7:23.0.1'
      compile 'com.mikhaellopez:hfrecyclerview:1.0.0'
      compile 'de.hdodenhof:circleimageview:2.1.0'
  
  
  
      testCompile 'junit:junit:4.12'
      compile project(':FORTSDKv1.2')
      compile ('com.android.support:appcompat-v7:+'){
          transitive = true;
      }
      compile 'com.victor:lib:1.0.1'
      compile 'com.google.code.gson:gson:2.6.2'
      compile 'com.shamanland:fonticon:0.1.9'
      compile 'com.android.support:design:23.3.0'
      compile('de.keyboardsurfer.android.widget:crouton:1.8.5@aar') {
          exclude group: 'com.google.android', module: 'support-v4'
      }
      compile 'com.google.guava:guava:19.0'
      compile 'org.bouncycastle:bcprov-jdk16:1.46'
      compile 'commons-codec:commons-codec:1.10'
  
  
  }
  </code></pre>
  
  <p><strong><em>XML File:</em></strong></p>
  
  <pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      tools:context="com.example.mmido.trivelgob2b.TrivelgoB2B.MainActivity"
      android:background="@drawable/new_splash"&gt;
  
      &lt;pl.droidsonroids.gif.GifImageView
          android:layout_width="120dp"
          android:layout_height="150dp"
          android:layout_gravity="center_horizontal|center_vertical"
          android:layout_marginBottom="20dp"
          android:id="@+id/gifview"
          /&gt;
  
  &lt;/FrameLayout&gt;
  </code></pre>