java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.customcounter/com.example.android.customcounter.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.ViewGroup.getChildAt(int)' on a null object reference

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Solutions on the web

via Stack Overflow by gmavişşş
, 1 year ago
Unable to start activity ComponentInfo{com.example.android.customcounter/com.example.android.customcounter.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.ViewGroup.getChildAt(int)' on a null object reference
via Stack Overflow by thousight
, 1 year ago
Unable to start activity ComponentInfo{space.markwen.www.units/space.markwen.www.units.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference
via Google Groups by Medyn, 1 year ago
Unable to start activity ComponentInfo{com.example.lifemakers.mapsforge/com.example.lifemakers.mapsforge.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.RelativeLayout.addView(android.view.View, int)' on a null object reference
via Stack Overflow by President Camacho
, 1 year ago
Unable to start activity ComponentInfo{benlab.app1ben/benlab.app1ben.game_page}: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.util.Random.nextInt()' on a null object reference
via GitHub by barbeau
, 1 year ago
Unable to start activity ComponentInfo{com.joulespersecond.seattlebusbot/org.onebusaway.android.ui.HomeActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int org.onebusaway.android.ui.AlertList.getCount()' on a null object reference
via Stack Overflow by Ricardo Amaya
, 3 months ago
Unable to start activity ComponentInfo{com.ramaya947yahoo.mymaps/com.ramaya947yahoo.mymaps.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int com.google.android.gms.maps.GoogleMap.getMapType()' on a null object reference
java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.ViewGroup.getChildAt(int)' on a null object reference
at com.example.android.customcounter.MainActivity.onCreate(MainActivity.java:68)
at android.app.Activity.performCreate(Activity.java:6556)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)

Users with the same issue

You are the first who have seen this exception.

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.