App crashes with error "Unfortunately MyApp has stopped". How to fix?
Hello everyone! I'm a beginner in Android development with Kotlin. I wrote a simple app — a task list (ToDo). When running on the emulator, everything worked, but when I installed the APK on my real phone (Samsung Galaxy A50, Android 11), the app crashes immediately after opening with the message "Unfortunately MyApp has stopped".\n\nHere is my MainActivity.kt code:\n\n```kotlin\nclass MainActivity : AppCompatActivity() {\n override fun onCreate(savedInstanceState: Bundle?) {\n super.onCreate(savedInstanceState)\n setContentView(R.layout.activity_main)\n\n val recyclerView = findViewById(R.id.recycler_tasks)\n val tasks = listOf("Buy bread", "Call mom", "Do homework")\n\n val adapter = TaskAdapter(tasks)\n recyclerView.adapter = adapter
No answers yet.
Log in to leave an answer