Android Studio - Error: App is crashing on Virtual Device

So, I am a new programmer and also new here on this platform. I have got a Problem. I tried everything like to watch Videos, read older Posts on StackOverflow, but nothing helped me really. That's why I wanted to ask you for help.

This is my Logcat after the crash report:

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference at de.S8S7.Spiel.onCreate(

And at this point it Shows the error:


And yeah, I am not native English speaker.

Beforde you can set the OnClickListeners, you have to load the instances of the Buttons like this:

btnAntwortEins = findViewById(;
btnAntwortZwei = findViewById(;
btnAntwortDrei = findViewById(;
btnAntwortVier = findViewById(;


The Id (e.g. btnIdAntwortEins) is what you have written into the Id field of each Button in the layout editor.

Detect and diagnose crashes, An app crash on an Android device Null pointer exceptions (identified by the runtime error type NullPointerException ) occur when you're� Android Studio App Crashes on Startup - Duration: 3:55. Simplified Coding 19,945 views. 3:55. Emulator: emnulator: ERROR: x86 emulation currently requires hardware acceleration! solution for

if its only crashing in virtual device then may be u have used google play service in your app and you have not istalled a emulator with play servivce. try to instyall emulator with play services.

Android Studio App Crashes on Startup, This video is for the absolute beginners. Are you facing - Unfortunately My Application has Duration: 3:55 Posted: Apr 20, 2019 If the Android Crashing problem is caused by viruses, you should try entering Recovery mode. You can boot directly into recovery mode and use it to factory reset the device, delete the cache partition, or apply software updates.

There might be a scenario of having such crash when you dont intialize the button correctly in android.So as you are new to Android development consider these things when you initialize the buttons in the Activity

You can mention the Button Globally like:

Button button;

you have to give the reference id which you have defined in the xml like;

protected void onCreate(Bundle savedInstanceState) {

    githubRepoUrlRecyclerView = findViewById(;

//mention on click listener after you have given the reference id.

button.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                //TODO task.

Why does my laptop crash when i run the android emulator?, The default emulator has a lot of compatibility issues and generally shows errors whenever you try to run an application. Even I faced the same problem last� Some antivirus software may be incompatible with the Android Emulator. If you're using Avast software and are having trouble running the Android Emulator, try disabling Use nested virtualization when available and Enable Hardware assisted virtualization in the Avast Troubleshooting settings. In addition, after Avast hardware virtualization is disabled, ensure that HAXM is set up properly again with a full re-installation of the latest HAXM from the SDK Manager.

My app keeps crashing. Whats the reason?, This clogs up your internal memory as well as corrupts the device's cache partition and Connect your phone to android studio, run the project. When your app crashes with message "Unfortunately blahblah has stopped working", then Now , check the logcat in android studio , and it will be displaying the cause of error. If your Android app crashes, then because of an uncaught RuntimeException like a NullPointerException. In this video we will learn, how to read the Logcat stack trace to find out what exception

5 Proven Solutions To Fix Android Emulator App Keeps Crashing, Solution 1: Check for enough disk space. Whenever you come across app keeps crashing on Android emulator, just check whether there is enough space or not. May 12, 2017 January 12, 2019 8 Comments on Fix for the Android Emulator (Android Simulator) crashing during launch UPDATE 2017.08.03: This should be fixed with the release of HAXM 6.1.1 . Make sure you’re running the latest version of Android Studio

Debugging Exceptions within your App, When building Android apps, your app is bound to crash from time to time or Before assuming the code is broken, try restarting the emulator, trying the app on a Android Studio, be sure to setup your Android Monitor to filter for "Errors" only � The emulator transparently rewrites the GET requests from the virtual device before talking to the proxy so it works. If your emulator must access the internet through a proxy server, you can configure a custom HTTP proxy from the emulator's Extended controls screen.