title: Failed to instantiate one or more classes error in android studio because of which the design isn't displayed
body: <p>I am facing problems with my layout in android studio which is not being displayed because of an error called "Failed to instantiate one or more classes." I'm also facing an error in my build.gradle app module file whose error message is shown below.</p>
  
  <p>I am new to android studio and I tried whatever I could on my part but I seem to be getting nowhere. Please let me know if you have a solution.</p>
  
  <ul>
  <li><p>I have tried changing my compileSdkVersion and targetSdkVersion to a lower version in build.gradle app module i.e. from 28 to 26 which didn't work.</p></li>
  <li><p>I have also tried cleaning the project followed by invalidating/restarting.</p></li>
  <li><p>I have tried rebuilding the project too.</p></li>
  </ul>
  
  <p><strong>My gradle file:</strong></p>
  
  <pre><code>apply plugin: 'com.android.application'
  apply plugin: 'com.google.gms.google-services'
  
  android {
      compileSdkVersion 28
      defaultConfig {
          applicationId "naik.dattaraj.meme2"
          minSdkVersion 22
          targetSdkVersion 28
          versionCode 1
          versionName "1.0"
          testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
          vectorDrawables.useSupportLibrary = true
          multiDexEnabled true
      }
      packagingOptions {
          exclude 'META-INF/DEPENDENCIES'
          exclude 'META-INF/LICENSE'
          //exclude 'META-INF/LICENSE-FIREBASE.txt'
          exclude 'META-INF/NOTICE'
          exclude 'META-INF/license.txt'
          exclude 'META-INF/notice.txt'
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
      implementation 'com.android.support:appcompat-v7:28.0.0' // This line shows the below mentioned error message
      implementation 'com.android.support:design:28.0.0'
      implementation 'com.android.support:cardview-v7:28.0.0'
      implementation 'com.android.support:support-v4:28.0.0'
      implementation 'com.android.support.constraint:constraint-layout:1.1.3'
      implementation 'com.android.support:support-vector-drawable:28.0.0'
      implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.0'
      implementation 'com.firebase:firebase-client-android:2.5.2'
      implementation 'com.google.firebase:firebase-database:18.0.0'
      implementation 'com.firebaseui:firebase-ui-database:2.1.0'
      implementation 'com.google.firebase:firebase-auth:18.1.0'
      implementation 'com.google.firebase:firebase-storage:18.1.0'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'com.android.support.test:runner:1.0.2'
      androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
      implementation 'com.android.support:recyclerview-v7:28.0.0'
      implementation 'com.squareup.picasso:picasso:2.5.2'
      implementation 'de.hdodenhof:circleimageview:3.0.0'
      implementation files('libs/CircleImageView-master/gradle/wrapper/gradle-wrapper.jar')
      implementation 'com.shitij.goyal:slide-button:1.0.0'
      implementation 'com.github.bumptech.glide:glide:4.8.0'
      implementation 'com.rengwuxian.materialedittext:library:2.1.4'
      implementation 'com.github.shts:StoriesProgressView:3.0.0'
      implementation 'com.github.pwittchen:swipe-rx2:0.3.0'
      implementation 'com.tomer:fadingtextview:2.5'
      implementation 'com.android.support:multidex:1.0.3'
      implementation 'com.andkulikov:transitionseverywhere:1.8.1'
  
      implementation 'com.android.support:exifinterface:28.0.0'
      implementation 'com.android.support:support-annotations:28.0.0'
      implementation 'androidx.annotation:annotation:1.0.1'
      implementation 'androidx.legacy:legacy-support-v4:1.0.0'
      implementation 'com.android.support:support-v13:28.0.0'
      implementation 'androidx.legacy:legacy-support-v13:1.0.0'
      implementation 'androidx.appcompat:appcompat:1.0.2'
      implementation 'androidx.vectordrawable:vectordrawable:1.0.1'
      implementation 'com.google.android.material:material:1.0.0'
      implementation 'com.android.support:gridlayout-v7:28.0.0'
      implementation 'androidx.gridlayout:gridlayout:1.0.0'
      implementation 'com.android.support:mediarouter-v7:28.0.0'
      implementation 'androidx.mediarouter:mediarouter:1.0.0'
      implementation 'androidx.cardview:cardview:1.0.0'
      implementation 'com.android.support:palette-v7:28.0.0'
      implementation 'androidx.palette:palette:1.0.0'
      implementation 'com.android.support:leanback-v17:28.0.0'
      implementation 'androidx.recyclerview:recyclerview:1.0.0'
      implementation 'androidx.leanback:leanback:1.0.0'
      implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
      implementation 'androidx.exifinterface:exifinterface:1.0.0'
      implementation 'android.arch.navigation:navigation-fragment:1.0.0-alpha09'
      implementation 'androidx.navigation:navigation-fragment:2.0.0-rc02'
      implementation 'android.arch.navigation:navigation-fragment-ktx:1.0.0-alpha09'
      implementation 'android.arch.navigation:navigation-ui:1.0.0-alpha09'
      implementation 'androidx.navigation:navigation-ui:2.0.0-rc02'
      implementation 'androidx.navigation:navigation-fragment-ktx:2.0.0-rc02'
      implementation 'androidx.test.espresso:espresso-core:3.1.1'
      implementation 'android.arch.navigation:navigation-ui-ktx:1.0.0-alpha09'
      implementation 'androidx.navigation:navigation-ui-ktx:2.0.0-rc02'
      implementation 'com.android.support.test.espresso:espresso-contrib:3.0.2'
      implementation 'androidx.navigation:navigation-runtime:2.0.0-rc02'
      implementation 'androidx.test.espresso:espresso-contrib:3.1.1'
      implementation 'com.android.support.test:rules:1.0.2'
      implementation 'androidx.test:rules:1.1.1'
      implementation 'com.android.databinding:library:3.3.0'
      implementation 'androidx.databinding:databinding-runtime:3.3.0'
      implementation 'com.android.databinding:baseLibrary:3.3.0'
      implementation 'androidx.databinding:databinding-common:3.3.0'
      implementation 'com.android.databinding:compiler:3.1.4'
      implementation 'androidx.databinding:databinding-compiler:3.3.0'
      implementation 'com.android.databinding:adapters:3.3.0'
      implementation 'androidx.databinding:databinding-adapters:3.3.0'
      implementation 'com.google.android.gms:play-services:12.0.1'
      implementation 'com.google.android.gms:play-services-ads:17.1.2'
      implementation 'com.google.android.gms:play-services-wearable:16.0.1'
      implementation 'com.google.android.gms:play-services-maps:16.0.0'
      compileOnly 'com.google.android.wearable:wearable:2.4.0'
      implementation 'com.google.android.support:wearable:2.4.0'
      annotationProcessor 'com.android.databinding:compiler:3.1.4'
      annotationProcessor 'androidx.databinding:databinding-compiler:3.3.0'
  
  }
  apply plugin: 'com.google.gms.google-services'
  com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
  </code></pre>
  
  <p><strong>I get the following error message in my design view:</strong></p>
  
  <blockquote>
    <p>The following classes could not be instantiated:
    - de.hdodenhof.circleimageview.CircleImageView (Open Class, Show Exception, Clear Cache)  Tip: Use View.isInEditMode() in your custom
    views to skip code or show sample data when shown in the IDE.  If this
    is an unexpected error you can also try to build the project, then
    manually refresh the layout.  Exception Details
    java.lang.IllegalArgumentException: ScaleType FIT_XY not supported.
      at
    de.hdodenhof.circleimageview.CircleImageView.setScaleType(CircleImageView.java:134)
      at android.widget.ImageView.(ImageView.java:203)   at
    android.widget.ImageView.(ImageView.java:172)   at
    de.hdodenhof.circleimageview.CircleImageView.(CircleImageView.java:98)
      at
    de.hdodenhof.circleimageview.CircleImageView.(CircleImageView.java:94)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      at
    android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
      at
    android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:863)
      at
    android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:837)
      at
    android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
      at
    android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:866)
      at
    android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:837)
      at
    android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
      at
    android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:866)
      at
    android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:837)
      at
    android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
      at
    android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:866)
      at
    android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:837)
      at
    android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:515)   at
    android.view.LayoutInflater.inflate(LayoutInflater.java:394)</p>
  </blockquote>
  
  <p><strong>And I get this error message in my build.gradle app module file:</strong></p>
  
  <blockquote>
    <p>Dependencies using groupId com.android.support and androidx.* can not
    be combined but found
    IdeMavenCoordinates{myGroupId='com.android.support',
    myArtifactId='support-v4', myVersion='26.1.0', myPacking='aar',
    myClassifier='null'} and
    IdeMavenCoordinates{myGroupId='androidx.documentfile',
    myArtifactId='documentfile', myVersion='1.0.0', myPacking='aar',
    myClassifier='null'} incompatible dependencies less... (Ctrl+F1) 
    Inspection info:There are some combinations of libraries, or tools and
    libraries, that are incompatible, or can lead to bugs. One such
    incompatibility is compiling with a version of the Android support
    libraries that is not the latest version (or in particular, a version
    lower than your targetSdkVersion).  Issue id: GradleCompatible</p>
  </blockquote>