title: Error inflating class android.support.constraint.ConstraintLayout
body: <p>I was working on an Android Studio application when I ran into this error.</p>
  
  <pre><code>    Process: com.example.visualizercopy, PID: 28098
      java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.visualizercopy/io.esense.MainActivity}: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class android.support.constraint.ConstraintLayout
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2751)
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2812)
          at android.app.ActivityThread.-wrap12(ActivityThread.java)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)
          at android.os.Handler.dispatchMessage(Handler.java:102)
          at android.os.Looper.loop(Looper.java:154)
          at android.app.ActivityThread.main(ActivityThread.java:6317)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)
       Caused by: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class android.support.constraint.ConstraintLayout
       Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.support.constraint.ConstraintLayout
       Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.constraint.ConstraintLayout" on path: DexPathList[[zip file "/data/app/com.example.visualizercopy-1/base.apk", zip file "/data/app/com.example.visualizercopy-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.visualizercopy-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.visualizercopy-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.visualizercopy-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.visualizercopy-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.visualizercopy-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.visualizercopy-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.visualizercopy-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.visualizercopy-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.visualizercopy-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.visualizercopy-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.visualizercopy-1/lib/arm64, /system/lib64, /vendor/lib64]]
          at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
          at android.view.LayoutInflater.createView(LayoutInflater.java:609)
          at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
          at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
          at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
          at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
          at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
          at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:424)
          at android.app.Activity.setContentView(Activity.java:2471)
          at io.esense.MainActivity.onCreate(MainActivity.java:41)
          at android.app.Activity.performCreate(Activity.java:6757)
          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2704)
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2812)
          at android.app.ActivityThread.-wrap12(ActivityThread.java)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)
          at android.os.Handler.dispatchMessage(Handler.java:102)
          at android.os.Looper.loop(Looper.java:154)
          at android.app.ActivityThread.main(ActivityThread.java:6317)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)
  2019-06-23 16:25:42.234 28098-28098/? E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)
  </code></pre>
  
  <p>This is my gradle:</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 29
      defaultConfig {
          applicationId "com.example.visualizercopy"
          minSdkVersion 23
          targetSdkVersion 29
          versionCode 1
          versionName "1.0"
          testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
      implementation 'androidx.appcompat:appcompat:1.1.0-beta01'
      implementation 'com.jjoe64:graphview:4.2.2'
      implementation 'com.android.support.constraint:constraint-layout:2.0.0-beta1'
      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'
  
  }
  </code></pre>
  
  <p>This is the constraint layout tag in my xml file</p>
  
  <pre class="lang-xml prettyprint-override"><code>&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:id="@+id/PLAY_PARENT"
      android:padding="0dp"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context=".MainActivity"
      tools:layout_editor_absoluteY="81dp"&gt;
  </code></pre>
  
  <p>I have looked into my error on this site and google, and the common answer is to add <code>compile 'com.android.support.constraint:constraint-layout:1.0.2'</code>, however compile is now obsolete, and when I replace compile with implementation and changed it to the newest version (<code>'com.android.support.constraint:constraint-layout:2.0.0-beta1'</code>) I still run into the same error. How can I fix this? </p>