The app keeps crashing when I open it on an emulator. This is the activity_main.xml and the error I get.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/main_nav_host"
android:name="com.example.test_run.main.MainSessionNavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="false" />
</androidx.constraintlayout.widget.ConstraintLayout>
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.test_run.MainActivity" on path: DexPathList[[zip file "/data/app/~~f3SDJdSMUvctPuzredlmhQ==/com.example.test_run-JMnAM1A0EvaUsPTrSDaFwA==/base.apk"],nativeLibraryDirectories=[/data/app/~~f3SDJdSMUvctPuzredlmhQ==/com.example.test_run-JMnAM1A0EvaUsPTrSDaFwA==/lib/arm64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
in your case maybe this is
add this line in your
ConstraintLayout
like below