title: NoClassDefFoundError: Class not found using the boot loader class loader Android Studio
body: <p>I've been working on a very basic app that sends a notification. I am getting this error and I have no idea why. I have looked at every similar question on stack overflow and nothing has worked. I have reinstalled and updated my .gradle file, changed dependencies and switched instant run off. </p>
  
  <p>I am trying to use a NotificationChannel, and it is not finding the library.</p>
  
  <p>Here is my build.gradle(:app)</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 29
      buildToolsVersion "29.0.3"
  
      defaultConfig {
          applicationId "com.example.labdirectreplynotification"
          minSdkVersion 16
          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'
      implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'androidx.test.ext:junit:1.1.1'
      androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
  }
  
  </code></pre>
  
  <p>and the location in which the error occurs</p>
  
  <pre><code> protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          nMgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
          createNotificationChannel(chID, "My News", "Example Direct Reply Notification");
      }
  
      private void createNotificationChannel(String id, String name, String desc) {
          NotificationChannel ch = new NotificationChannel(id, name, NotificationManager.IMPORTANCE_HIGH);
          ch.setDescription(desc); ch.enableLights(true); ch.setLightColor(Color.RED);
          ch.enableVibration(true);
          ch.setVibrationPattern(new long[] {100,200,300,400,500,400,300,200,400});
          nMgr.createNotificationChannel(ch);
          processInlineReply();
      }
  </code></pre>
  
  <p>and the error</p>
  
  <pre><code>java.lang.NoClassDefFoundError: Failed resolution of: Landroid/app/NotificationChannel;
          at com.example.labdirectreplynotification.MainActivity.createNotificationChannel(MainActivity.java:40)
          at com.example.labdirectreplynotification.MainActivity.onCreate(MainActivity.java:32)
          at android.app.Activity.performCreate(Activity.java:6877)
          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136)
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3209)
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3352)
          at android.app.ActivityThread.access$1100(ActivityThread.java:223)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1797)
          at android.os.Handler.dispatchMessage(Handler.java:102)
          at android.os.Looper.loop(Looper.java:158)
          at android.app.ActivityThread.main(ActivityThread.java:7231)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
       Caused by: java.lang.ClassNotFoundException: Didn't find class "android.app.NotificationChannel" on path: DexPathList[[zip file "/data/app/com.example.labdirectreplynotification-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.labdirectreplynotification-1/lib/arm64, /vendor/lib64, /system/lib64]]
          at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
          at com.example.labdirectreplynotification.MainActivity.createNotificationChannel(MainActivity.java:40) 
          at com.example.labdirectreplynotification.MainActivity.onCreate(MainActivity.java:32) 
          at android.app.Activity.performCreate(Activity.java:6877) 
          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136) 
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3209) 
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3352) 
          at android.app.ActivityThread.access$1100(ActivityThread.java:223) 
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1797) 
          at android.os.Handler.dispatchMessage(Handler.java:102) 
          at android.os.Looper.loop(Looper.java:158) 
          at android.app.ActivityThread.main(ActivityThread.java:7231) 
          at java.lang.reflect.Method.invoke(Native Method) 
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
          Suppressed: java.lang.ClassNotFoundException: android.app.NotificationChannel
          at java.lang.Class.classForName(Native Method)
          at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
          at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
                  ... 15 more
       Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
  </code></pre>