title: Android Studio Error: Activity must extend android.app.activity
body: <p>I am making a relatively simple app for a school project. This is my first time working with android studio btw.
  The purpose of the app is to be able to draw inside of a given area, the code for the drawing part I copied from here: <a href="https://guides.codepath.com/android/Basic-Painting-with-Views" rel="nofollow noreferrer">https://guides.codepath.com/android/Basic-Painting-with-Views</a>
  I'm pretty sure that android studio converted the code into kotlin when I pasted it in, but I might be wrong about that.</p>
  <p>The error is showing up in my androidmanifest, in the line '&lt;activity android:name&quot;com.example.colourkiller.Drawactivity&quot;. The &quot;com.example.colourkiller.Drawactivity&quot; is marked in red, and the error says: &quot;Drawactivity must extend android.app.activity&quot; and &quot;This class should provide a default instructor&quot;</p>
  <p>AndroidManifest:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      package=&quot;com.example.colourkiller&quot;&gt;
  
      &lt;application
          android:allowBackup=&quot;true&quot;
          android:icon=&quot;@mipmap/ic_launcher&quot;
          android:label=&quot;@string/app_name&quot;
          android:roundIcon=&quot;@mipmap/ic_launcher_round&quot;
          android:supportsRtl=&quot;true&quot;
          android:theme=&quot;@style/Theme.ColourKiller&quot;&gt;
          &lt;activity android:name=&quot;com.example.colourkiller.DrawActivity&quot;
              android:label=&quot;@string/app_name&quot;&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
                  &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  <p>MainActivity:</p>
  <pre><code>package com.example.colourkiller
  
  import android.content.Context
  import android.graphics.Canvas
  import android.graphics.Color
  import android.graphics.Paint
  import android.graphics.Path
  import android.util.AttributeSet
  import android.view.MotionEvent
  import android.view.View
  
  
  public class DrawActivity(context: Context?, attrs: AttributeSet?) : View(context, attrs) {
      // setup initial color
      private val paintColor = Color.BLACK
  
      // defines paint and canvas
      private var drawPaint: Paint? = null
  
      // stores next circle
      private val path = Path()
      private fun setupPaint() {
          // Setup paint with color and stroke styles
          drawPaint = Paint()
          drawPaint!!.color = paintColor
          drawPaint!!.isAntiAlias = true
          drawPaint!!.strokeWidth = 5f
          drawPaint!!.style = Paint.Style.STROKE
          drawPaint!!.strokeJoin = Paint.Join.ROUND
          drawPaint!!.strokeCap = Paint.Cap.ROUND
      }
  
      override fun onDraw(canvas: Canvas) {
          canvas.drawPath(path, drawPaint!!)
      }
  
      override fun onTouchEvent(event: MotionEvent): Boolean {
          val pointX = event.x
          val pointY = event.y
          when (event.action) {
              MotionEvent.ACTION_DOWN -&gt; {
                  path.moveTo(pointX, pointY)
                  return true
              }
              MotionEvent.ACTION_MOVE -&gt; path.lineTo(pointX, pointY)
              else -&gt; return false
          }
          // Force a view to draw again
          postInvalidate()
          return true
      }
  
      init {
          isFocusable = true
          isFocusableInTouchMode = true
          setupPaint()
      }
  }
  </code></pre>
  <p>Activity_main.xml (layout):</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      android:background=&quot;#FFFFFF&quot;
      tools:context=&quot;.DrawActivity&quot; &gt;
  
  
      &lt;RelativeLayout
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          tools:context=&quot;.MainActivity&quot; &gt;
  
          &lt;com.example.colourkiller.DrawActivity
              android:id=&quot;@+id/simpleDrawingView1&quot;
              android:layout_width=&quot;385dp&quot;
              android:layout_height=&quot;583dp&quot;
              android:layout_alignParentStart=&quot;true&quot;
              android:layout_alignParentTop=&quot;true&quot;
              android:layout_alignParentEnd=&quot;true&quot;
              android:layout_alignParentBottom=&quot;true&quot;
              android:layout_marginStart=&quot;13dp&quot;
              android:layout_marginTop=&quot;69dp&quot;
              android:layout_marginEnd=&quot;13dp&quot;
              android:layout_marginBottom=&quot;79dp&quot; /&gt;
  
      &lt;/RelativeLayout&gt;
  
  
      &lt;TextView
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:background=&quot;#D3CACA&quot;
          android:text=&quot;@string/app_name&quot;
          android:textAllCaps=&quot;true&quot;
          android:textColor=&quot;#2196F3&quot;
          android:textColorHighlight=&quot;#930F0F&quot;
          android:textSize=&quot;30sp&quot;
          android:textStyle=&quot;bold&quot;
          android:translationZ=&quot;1dp&quot;
          app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
          app:layout_constraintHorizontal_bias=&quot;0.501&quot;
          app:layout_constraintLeft_toLeftOf=&quot;parent&quot;
          app:layout_constraintRight_toRightOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot;
          app:layout_constraintVertical_bias=&quot;0.018&quot; /&gt;
  
      &lt;View
          android:id=&quot;@+id/view2&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;68dp&quot;
          android:background=&quot;#A6A3A3&quot;
          app:layout_constraintBottom_toBottomOf=&quot;@+id/view&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintHorizontal_bias=&quot;1.0&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot;
          app:layout_constraintVertical_bias=&quot;0.0&quot; /&gt;
  
      &lt;Button
          android:id=&quot;@+id/Saved&quot;
          android:layout_width=&quot;111dp&quot;
          android:layout_height=&quot;60dp&quot;
          android:layout_marginStart=&quot;16dp&quot;
          android:layout_marginBottom=&quot;12dp&quot;
          android:backgroundTint=&quot;#2196F3&quot;
          android:text=&quot;@string/saved&quot;
          app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot; /&gt;
  
      &lt;Button
          android:id=&quot;@+id/Colours&quot;
          android:layout_width=&quot;111dp&quot;
          android:layout_height=&quot;60dp&quot;
          android:layout_marginBottom=&quot;12dp&quot;
          android:backgroundTint=&quot;#2196F3&quot;
          android:text=&quot;@string/Colours&quot;
          app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintHorizontal_bias=&quot;0.946&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot; /&gt;
  
      &lt;Button
          android:id=&quot;@+id/KILL&quot;
          android:layout_width=&quot;111dp&quot;
          android:layout_height=&quot;60dp&quot;
          android:layout_marginStart=&quot;32dp&quot;
          android:layout_marginEnd=&quot;16dp&quot;
          android:backgroundTint=&quot;@color/red&quot;
          android:text=&quot;@string/KILL&quot;
          android:textSize=&quot;24sp&quot;
          android:textStyle=&quot;bold&quot;
          app:iconTint=&quot;#FFFFFF&quot;
          app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintHorizontal_bias=&quot;0.476&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot;
          app:layout_constraintVertical_bias=&quot;0.98&quot; /&gt;
  
      &lt;View
          android:id=&quot;@+id/view&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;80dp&quot;
          android:background=&quot;#A6A3A3&quot;
          app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
          tools:layout_editor_absoluteX=&quot;0dp&quot; /&gt;
  
      &lt;View
          android:layout_width=&quot;12dp&quot;
          android:layout_height=&quot;match_parent&quot;
          android:background=&quot;#A6A3A3&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;
  
      &lt;View
          android:layout_width=&quot;12dp&quot;
          android:layout_height=&quot;match_parent&quot;
          android:background=&quot;#A6A3A3&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;
  
  
      &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>
  <p>I've already tried:</p>
  <ol>
  <li>Updating everything to the latest versions</li>
  <li>Rebuilding the project</li>
  <li>Invalidate Cashes/restart</li>
  </ol>
  <p>I think the problem is in the defining of the class in MainActivity, but as this is my first time using androidstudio I'm not too sure. Any help is greatly appreciated!</p>