Unfortunately MyApp has stopped. How can I solve this?












693















I am developing an application, and everytime I run it, I get the message:




Unfortunately, MyApp has stopped.




What can I do to solve this?





About this question - obviously inspired by What is a stack trace, and how can I use it to debug my application errors?, there are lots of questions stating that their application has crashed, without any further detail. This question aims to instruct novice Android programmers on how to try and fix their problems themselves, or ask the right questions.










share|improve this question




















  • 20





    I've seen many questions getting closed as dupes with this. This is a good reference for helping people post relevant data in their questions. However, this isn't a duplicate of any root problem there but just methodology for digging out the root problem. I think it would be better just to provide the link to this question as a reference and not close as duplicate.

    – laalto
    May 18 '14 at 6:48






  • 30





    I think the close function is perfect for this. Most of these questions show little knowledge of the basic debugging skills. Putting them on hold provides a chance for them to clarify their problem, using the method as stated in the answer. Better yet, they might be able to solve the problem themselves. This discussion might be better suited for meta.stackoverflow.com though.

    – nhaarman
    May 19 '14 at 22:06













  • This question is too vague. A better question would be 'using [myIDE] how do I debug' an Android application that's displaying the error 'Unfortunately, MyApp has stopped'

    – Chris Halcrow
    Oct 30 '15 at 0:50








  • 5





    @ChrisHalcrow This Q/A is not about debugging at all. It is about guiding beginners in Android how to deal with app crashes.

    – nhaarman
    Oct 30 '15 at 7:58











  • stackoverflow.com/questions/26609734/….. enable the multidex becoz error in convert to apk

    – RejoylinLokeshwaran
    Nov 25 '17 at 7:47
















693















I am developing an application, and everytime I run it, I get the message:




Unfortunately, MyApp has stopped.




What can I do to solve this?





About this question - obviously inspired by What is a stack trace, and how can I use it to debug my application errors?, there are lots of questions stating that their application has crashed, without any further detail. This question aims to instruct novice Android programmers on how to try and fix their problems themselves, or ask the right questions.










share|improve this question




















  • 20





    I've seen many questions getting closed as dupes with this. This is a good reference for helping people post relevant data in their questions. However, this isn't a duplicate of any root problem there but just methodology for digging out the root problem. I think it would be better just to provide the link to this question as a reference and not close as duplicate.

    – laalto
    May 18 '14 at 6:48






  • 30





    I think the close function is perfect for this. Most of these questions show little knowledge of the basic debugging skills. Putting them on hold provides a chance for them to clarify their problem, using the method as stated in the answer. Better yet, they might be able to solve the problem themselves. This discussion might be better suited for meta.stackoverflow.com though.

    – nhaarman
    May 19 '14 at 22:06













  • This question is too vague. A better question would be 'using [myIDE] how do I debug' an Android application that's displaying the error 'Unfortunately, MyApp has stopped'

    – Chris Halcrow
    Oct 30 '15 at 0:50








  • 5





    @ChrisHalcrow This Q/A is not about debugging at all. It is about guiding beginners in Android how to deal with app crashes.

    – nhaarman
    Oct 30 '15 at 7:58











  • stackoverflow.com/questions/26609734/….. enable the multidex becoz error in convert to apk

    – RejoylinLokeshwaran
    Nov 25 '17 at 7:47














693












693








693


152






I am developing an application, and everytime I run it, I get the message:




Unfortunately, MyApp has stopped.




What can I do to solve this?





About this question - obviously inspired by What is a stack trace, and how can I use it to debug my application errors?, there are lots of questions stating that their application has crashed, without any further detail. This question aims to instruct novice Android programmers on how to try and fix their problems themselves, or ask the right questions.










share|improve this question
















I am developing an application, and everytime I run it, I get the message:




Unfortunately, MyApp has stopped.




What can I do to solve this?





About this question - obviously inspired by What is a stack trace, and how can I use it to debug my application errors?, there are lots of questions stating that their application has crashed, without any further detail. This question aims to instruct novice Android programmers on how to try and fix their problems themselves, or ask the right questions.







java android debugging kotlin crash






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 11 '18 at 9:41









naXa

14k892137




14k892137










asked Apr 28 '14 at 23:55









nhaarmannhaarman

60.9k45201245




60.9k45201245








  • 20





    I've seen many questions getting closed as dupes with this. This is a good reference for helping people post relevant data in their questions. However, this isn't a duplicate of any root problem there but just methodology for digging out the root problem. I think it would be better just to provide the link to this question as a reference and not close as duplicate.

    – laalto
    May 18 '14 at 6:48






  • 30





    I think the close function is perfect for this. Most of these questions show little knowledge of the basic debugging skills. Putting them on hold provides a chance for them to clarify their problem, using the method as stated in the answer. Better yet, they might be able to solve the problem themselves. This discussion might be better suited for meta.stackoverflow.com though.

    – nhaarman
    May 19 '14 at 22:06













  • This question is too vague. A better question would be 'using [myIDE] how do I debug' an Android application that's displaying the error 'Unfortunately, MyApp has stopped'

    – Chris Halcrow
    Oct 30 '15 at 0:50








  • 5





    @ChrisHalcrow This Q/A is not about debugging at all. It is about guiding beginners in Android how to deal with app crashes.

    – nhaarman
    Oct 30 '15 at 7:58











  • stackoverflow.com/questions/26609734/….. enable the multidex becoz error in convert to apk

    – RejoylinLokeshwaran
    Nov 25 '17 at 7:47














  • 20





    I've seen many questions getting closed as dupes with this. This is a good reference for helping people post relevant data in their questions. However, this isn't a duplicate of any root problem there but just methodology for digging out the root problem. I think it would be better just to provide the link to this question as a reference and not close as duplicate.

    – laalto
    May 18 '14 at 6:48






  • 30





    I think the close function is perfect for this. Most of these questions show little knowledge of the basic debugging skills. Putting them on hold provides a chance for them to clarify their problem, using the method as stated in the answer. Better yet, they might be able to solve the problem themselves. This discussion might be better suited for meta.stackoverflow.com though.

    – nhaarman
    May 19 '14 at 22:06













  • This question is too vague. A better question would be 'using [myIDE] how do I debug' an Android application that's displaying the error 'Unfortunately, MyApp has stopped'

    – Chris Halcrow
    Oct 30 '15 at 0:50








  • 5





    @ChrisHalcrow This Q/A is not about debugging at all. It is about guiding beginners in Android how to deal with app crashes.

    – nhaarman
    Oct 30 '15 at 7:58











  • stackoverflow.com/questions/26609734/….. enable the multidex becoz error in convert to apk

    – RejoylinLokeshwaran
    Nov 25 '17 at 7:47








20




20





I've seen many questions getting closed as dupes with this. This is a good reference for helping people post relevant data in their questions. However, this isn't a duplicate of any root problem there but just methodology for digging out the root problem. I think it would be better just to provide the link to this question as a reference and not close as duplicate.

– laalto
May 18 '14 at 6:48





I've seen many questions getting closed as dupes with this. This is a good reference for helping people post relevant data in their questions. However, this isn't a duplicate of any root problem there but just methodology for digging out the root problem. I think it would be better just to provide the link to this question as a reference and not close as duplicate.

– laalto
May 18 '14 at 6:48




30




30





I think the close function is perfect for this. Most of these questions show little knowledge of the basic debugging skills. Putting them on hold provides a chance for them to clarify their problem, using the method as stated in the answer. Better yet, they might be able to solve the problem themselves. This discussion might be better suited for meta.stackoverflow.com though.

– nhaarman
May 19 '14 at 22:06







I think the close function is perfect for this. Most of these questions show little knowledge of the basic debugging skills. Putting them on hold provides a chance for them to clarify their problem, using the method as stated in the answer. Better yet, they might be able to solve the problem themselves. This discussion might be better suited for meta.stackoverflow.com though.

– nhaarman
May 19 '14 at 22:06















This question is too vague. A better question would be 'using [myIDE] how do I debug' an Android application that's displaying the error 'Unfortunately, MyApp has stopped'

– Chris Halcrow
Oct 30 '15 at 0:50







This question is too vague. A better question would be 'using [myIDE] how do I debug' an Android application that's displaying the error 'Unfortunately, MyApp has stopped'

– Chris Halcrow
Oct 30 '15 at 0:50






5




5





@ChrisHalcrow This Q/A is not about debugging at all. It is about guiding beginners in Android how to deal with app crashes.

– nhaarman
Oct 30 '15 at 7:58





@ChrisHalcrow This Q/A is not about debugging at all. It is about guiding beginners in Android how to deal with app crashes.

– nhaarman
Oct 30 '15 at 7:58













stackoverflow.com/questions/26609734/….. enable the multidex becoz error in convert to apk

– RejoylinLokeshwaran
Nov 25 '17 at 7:47





stackoverflow.com/questions/26609734/….. enable the multidex becoz error in convert to apk

– RejoylinLokeshwaran
Nov 25 '17 at 7:47












16 Answers
16






active

oldest

votes


















636














This answer describes the process of retrieving the stack trace. Already have the stack trace? Read up on stack traces in "What is a stack trace, and how can I use it to debug my application errors?"



The Problem



Your application quit because an uncaught RuntimeException was thrown.

The most common of these is the NullPointerException.



How to solve it?



Every time an Android application crashes (or any Java application for that matter), a Stack trace is written to the console (in this case, logcat). This stack trace contains vital information for solving your problem.



Android Studio



Finding the stack trace in Android Studio



In the bottom bar of the window, click on the Logcat button. Alternatively, you can press alt+6. Make sure your emulator or device is selected in the Devices panel. Next, try to find the stack trace, which is shown in red. There may be a lot of stuff logged into logcat, so you may need to scroll a bit. An easy way to find the stack trace is to clear the logcat (using the recycle bin on the right), and let the app crash again.



I have found the stack trace, now what?



Yay! You're halfway to solving your problem.

You only need to find out what exactly made your application crash, by analyzing the stack trace.



Read up on stack traces in "What is a stack trace, and how can I use it to debug my application errors?"



I still can't solve my problem!



If you've found your Exception and the line where it occurred, and still cannot figure out how to fix it, don't hesitate to ask a question on StackOverflow.



Try to be as concise as possible: post the stack trace, and the relevant code (e.g. a few lines up to the line which threw the Exception).






share|improve this answer





















  • 28





    I know this post is old: but if you use IntelliJ IDEA you can go inside Android > Devices|Logcat and add a new filter (i.imgur.com/145dtkx.png), and filter it for by Log Message here you can put FATAL EXCEPTION (i.imgur.com/HpELhaU.png) so in this Box you can read all Exceptions which are throw by your application. With this you don't need to clear logcat and do the crash again. I think Android Studio have this option too.

    – Marco Acierno
    Jun 14 '14 at 14:49








  • 1





    Filtering logcat in Eclipse can be done by typing in the java package name in the application name field of the filter.

    – Stephane
    Mar 21 '15 at 12:38











  • I think the main point is understanding the trace back one gets when the exception happens. FCs are a bit bad when there is no trace back or not a usable one, which is where it gets hairy. but I think this explanation is a nice first intro in finding/identifying such bugs.

    – DooMMasteR
    Aug 19 '15 at 14:43






  • 3





    Things are easy when your logcat has some trace of error, but what in case logcat has nothing? stackoverflow.com/questions/32455645/…

    – Marian Paździoch
    Sep 8 '15 at 10:50






  • 3





    The problem is the line does not contain the error which is written and pointed by the stack trace.

    – Hilal
    Mar 10 '17 at 13:22



















92














You can use Google's ADB tool to get Logcat file to analyze the issue.



adb logcat > logcat.txt


open logcat.txt file and search for your application name. There should be information on why it failed, the line number ,Class name etc.






share|improve this answer


























  • This is great, it'll show you quickly anything going on on the device even if your debugger is failing to catch it, which can happen for Xamarin if the runtime fails to load.

    – jvenema
    Oct 10 '15 at 18:47






  • 1





    I couldn't see why my app was crashing in the android studio logcat, there were no errors at all. This answer gave me what I needed. Later on however I realised that I had some filter on in the studio logcat which was preventing me from seeing the error. I switched back to "Show only selected application" and I was back up and running.

    – Yannick
    Oct 30 '15 at 23:47













  • you should add -d, otherwise you nave to ctrl-C to exit logcat. I do adb logcat -v time -d > filename.txt

    – Karakuri
    Dec 6 '16 at 1:35



















31














First you check which point your app has crashed (Unfortunately, MyApp has stopped.). For this you can use Log.e("TAG","Message");, using this line you can see you app log in logcat.



After that you find which point your app has stopped its very easy to solve at your side.






share|improve this answer

































    22














    Just check the error in log cat.



    You get the log cat option from in eclipse:




    window->show view->others->Android->Logcat




    Log cat contains error.



    Other wise you can also check the error by executing an application in debug mode.
    Firstly set breakpoint after that by doing:




    right click on project->debug as->Android application







    share|improve this answer

































      20














      Note: This answer is using Android Studio 2.2.2



      Note 2: I am considering that your device is successfully connected.





      The first thing you do when your application crashes is look into the LogCat, at the bottom of Android Studio there's a toolbar with a list of menus:



      image



      Click on the "Android Monitor" (The one I underlined in the image above. ^)



      Now, you'll get something like this:



      image



      Change "Verbose" to "Error" Now it will only show you logged errors. Don't worry about all these errors (if you got them) now.



      image



      Ok. Now, do what you did to crash your app. After your app crashes, go to your logcat. You should find a new crash log that has a lot of at:x.x.x: and Caused by: TrumpIsPresidentException for example. Go to that Caused by: statement in your logcat.



      image



      Next to that Caused By:, there should be the Exception that happened. In my case, it's a RuntimeException and under it there should be a line which contains a blue link such as:



      image



      If that Caused by: DOESN'T have a line with a blue text somewhere under it, then look for another Caused by: that does.



      Click on that blue link. It should take you to where the problem occured. In my case, it was due to this line:



      throw new RuntimeException();


      So, now I know why it's crashing. It's because I'm throwing the exception myself. This was an obvious error.





      However, let's say I got another error:



      java.lang.NullPointerException


      I checked my logcat, I clicked on the blue link it gave me, and it took me here:



      mTextView.setText(myString);


      So, now I want to debug. According to this StackOverflow question, a NullPointerException says that something is null.



      So, let's find out what is null. There's two possibilities. Either mTextView is null, or myString is null. To find out, before the mTextView.setText(mString) line, I add these two lines:



      Log.d("AppDebug","mTextView is null: " + String.valueOf(mTextView == null);
      Log.d("AppDebug","myString is null: " + String.valueOf(myString== null);


      Now, like we did previously (We changed Verose to Error), we want to change "Error" to "Debug". Since we're logging by debugging. Here's all the Log methods:



      Log.
      d means Debug
      e means error
      w means warning
      v means verbose
      i means information
      wtf means "What a terrible failure". This is similar to Log.e


      So, since we used Log.d, we're checking in Debug. That's why we changed it to debug.



      Notice Log.d has a first parameter,in our case "AppDebug". Click on the "No Filters" drop down menu on the top-right of the logcat. Select "Edit Filter Configuration", give a name to your filter, and in "Log Tag" put "App Debug". Click "OK". Now, you should see two lines in the logcat:



      yourPackageNameAndApp: mTextView is null: true
      yourPackageNameAndApp: myString is null: false


      So now we know that mTextView is null.



      I observe my code, now I notice something.



      I have private TextView mTextView declared at the top of my class. But, I'm not defining it.



      Basically I forgot to do this in my onCreate():



      mTextView = (TextView) findViewById(R.id.textview_id_in_xml);


      So THAT'S why mTextView is null, because I forgot to tell my app what it is. So I add that line, run my app, and now the app doesn't crash.









      share|improve this answer


























      • What condition causes TrumpIsPresidentException :) ?

        – Vivek Mishra
        Mar 29 '17 at 13:02






      • 3





        @VivekMishra When a wall is built

        – Ab_
        Mar 29 '17 at 13:15













      • This is good information, but using images of the Stack Trace diminishes its usefulness - images can't be searched, can't be copied and pasted, can't be picked up by screen readers, and are more difficult to read. (I didn't downvote, by the way, just pointing that out).

        – EJoshuaS
        May 18 '18 at 13:23








      • 1





        @EJoshuaS I didn't say to provide images tho.

        – Ab_
        Jun 5 '18 at 9:57



















      13














      This popup shows only when you get a fatal exception in your code which stops the execution of the app. It could be any exception NullPointerException, OutOfMemoryException etc.



      Best way to check is through Logcat if you are still developing the app in Android studio which is quick way to read stack trace and check the cause of the app.



      If your app is already live, then you can not use logcat. So, for that you can implement Crashlytics to provide you bug reports of any exception that occurs.






      share|improve this answer

































        11














        Check your Logcat message and see your Manifest file. There should be something missing like defining the Activity,User permission`, etc.






        share|improve this answer

































          10














          You can use any of these tools:





          1. adb logcat


          2. adb logcat > logs.txt (you can use editors to open and search errors.)


          3. eclipse logcat (If not visible in eclipse, Go to Windows->Show View->Others->Android->LogCat)


          4. Android Debug Monitor or Android Device Monitor(type command monitor or open through UI)




          enter image description here





          1. Android Studio




          I suggest to use Android Debug Monitor, it is good. Because eclipse hangs when too many logs are there, and through adb logcat filter and all difficult.






          share|improve this answer

































            8














            You have to check the Stack trace



            How to do that?



            on Your IDE Check the windows form LOGCAT



            If you cant see the logcat windows go to this path and open it



            window->show view->others->Android->Logcat


            if you are using Google-Api go to this path



            adb logcat > logcat.txt






            share|improve this answer































              7














              Let me share a basic Logcat analysis for when you meet a Force Close (when app stops working).



              DOCS



              Basic tool from Android to collect/analyse logs is the logcat.



              HERE is the Android's page about logcat



              If you use android Studio, you can also check this LINK.



              Capturing



              Basically, you can MANUALLY capture logcat with following command (or just check AndroidMonitor window in AndroidStudio):



              adb logcat


              There's a lot of parameters you can add to command which helps you to filter and display the message that you want... This is personal... I always use the command below to get the message timestamp:



              adb logcat -v time


              You can redirect the output to a file and analyze it in a Text Editor.



              Analyzing



              If you app is Crashing, you'll get something like:



              07-09 08:29:13.474 21144-21144/com.example.khan.abc D/AndroidRuntime: Shutting down VM
              07-09 08:29:13.475 21144-21144/com.example.khan.abc E/AndroidRuntime: FATAL EXCEPTION: main
              Process: com.example.khan.abc, PID: 21144
              java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v4.app.FragmentActivity.onBackPressed()' on a null object reference
              at com.example.khan.abc.AudioFragment$1.onClick(AudioFragment.java:125)
              at android.view.View.performClick(View.java:4848)
              at android.view.View$PerformClick.run(View.java:20262)
              at android.os.Handler.handleCallback(Handler.java:815)
              at android.os.Handler.dispatchMessage(Handler.java:104)
              at android.os.Looper.loop(Looper.java:194)
              at android.app.ActivityThread.main(ActivityThread.java:5631)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:372)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
              07-09 08:29:15.195 21144-21144/com.example.khan.abc I/Process: Sending signal. PID: 21144 SIG: 9


              This part of the log shows you a lot of information:




              • When the issue happened: 07-09 08:29:13.475


              It is important to check when the issue happened... You may find several errors in a log... you must be sure that you are checking the proper messages :)




              • Which app crashed: com.example.khan.abc


              This way, you know which app crashed (to be sure that you are checking the logs about your message)




              • Which ERROR: java.lang.NullPointerException


              A NULL Pointer Exception error




              • Detailed info about the error: Attempt to invoke virtual method 'void android.support.v4.app.FragmentActivity.onBackPressed()' on a null object reference


              You tried to call method onBackPressed() from a FragmentActivity object. However, that object was null when you did it.





              • Stack Trace: Stack Trace shows you the method invocation order... Sometimes, the error happens in the calling method (and not in the called method).



                at com.example.khan.abc.AudioFragment$1.onClick(AudioFragment.java:125)




              Error happened in file com.example.khan.abc.AudioFragment.java, inside onClick() method at line: 125 (stacktrace shows the line that error happened)



              It was called by:



              at android.view.View.performClick(View.java:4848)


              Which was called by:



              at android.view.View$PerformClick.run(View.java:20262)


              which was called by:



              at android.os.Handler.handleCallback(Handler.java:815)


              etc....



              Overview



              This was just an overview... Not all logs are simple etc... It is just to share the idea and provide a entry-level information to you...



              I hope I could help you someway...
              Regards






              share|improve this answer































                7














                In below showToast() method you have to pass another parameter for context or application context by doing so you can try it.



                  public void showToast(String error, Context applicationContext){
                LayoutInflater inflater = getLayoutInflater();
                View view = inflater.inflate(R.layout.custom_toast, (ViewGroup)
                findViewById(R.id.toast_root));
                TextView text = (TextView) findViewById(R.id.toast_error);
                text.setText(error);
                Toast toast = new Toast(applicationContext);
                toast.setGravity(Gravity.TOP | Gravity.FILL_HORIZONTAL, 0, 0);
                toast.setDuration(Toast.LENGTH_SHORT);
                toast.setView(view);
                toast.show();
                }





                share|improve this answer

































                  6














                  Use the LogCat and try to find what is causing the app to crash.



                  To see Logcat if you use Android Studio then Press ALT + 6
                  or



                  if you use Eclipse then
                  Window -> Open Perspective -> Other - LogCat



                  Go to the LogCat, from the drop down menu select error. This will contain all the required information to help you debug. If that doesn't help, post the LogCat as an edit to your question and somebody will help you out.






                  share|improve this answer































                    4














                    If your app for some reason crashes without good stacktrace. Try debug it from first line, and go line by line until crash. Then you will have answer, which line is causing you trouble. Proably you could then wrapp it into try catch block and print error output.






                    share|improve this answer































                      3














                      You can also get this error message on its own, without any stack trace or any further error message.



                      In this case you need to make sure your Android manifest is configured correctly (including any manifest merging happening from a library and any activity that would come from a library), and pay particular attention to the first activity displayed in your application in your manifest files.






                      share|improve this answer



















                      • 3





                        I would be interested if you could upload a project that demonstrates this phenomenon.

                        – CommonsWare
                        Apr 28 '15 at 20:07



















                      2














                      Crash during development



                      Try logview-0.20 to get the logs and analyze them during development.

                      Make sure to mark ./logview and ./lib/logview.jar as executable when running in Linux.



                      If you don't like it, there're a lot of alternative desktop log viewers for Android.



                      Crash in the wild



                      Integrate a real-time crash reporting tool such as Firebase Crashlytics in order to get stacktraces of unhandled exceptions which occurred on users' devices.



                      Read How to Release a Buggy App (And Live to Tell the Tale) to know more about handling bugs in the field.






                      share|improve this answer

































                        1














                        People make mistakes, and so coding as well.



                        When ever any error happened, always check with the logcat with the text in red color however u can find out the real problem in blue color text with underline in those red color text.



                        Make sure if u create a new activity, always declare the activity in the AndroidManifest file.



                        If adding Permission, declare it in the AndroidMainifest file as well.






                        share|improve this answer
























                          protected by CommonsWare May 12 '14 at 18:06



                          Thank you for your interest in this question.
                          Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                          Would you like to answer one of these unanswered questions instead?














                          16 Answers
                          16






                          active

                          oldest

                          votes








                          16 Answers
                          16






                          active

                          oldest

                          votes









                          active

                          oldest

                          votes






                          active

                          oldest

                          votes









                          636














                          This answer describes the process of retrieving the stack trace. Already have the stack trace? Read up on stack traces in "What is a stack trace, and how can I use it to debug my application errors?"



                          The Problem



                          Your application quit because an uncaught RuntimeException was thrown.

                          The most common of these is the NullPointerException.



                          How to solve it?



                          Every time an Android application crashes (or any Java application for that matter), a Stack trace is written to the console (in this case, logcat). This stack trace contains vital information for solving your problem.



                          Android Studio



                          Finding the stack trace in Android Studio



                          In the bottom bar of the window, click on the Logcat button. Alternatively, you can press alt+6. Make sure your emulator or device is selected in the Devices panel. Next, try to find the stack trace, which is shown in red. There may be a lot of stuff logged into logcat, so you may need to scroll a bit. An easy way to find the stack trace is to clear the logcat (using the recycle bin on the right), and let the app crash again.



                          I have found the stack trace, now what?



                          Yay! You're halfway to solving your problem.

                          You only need to find out what exactly made your application crash, by analyzing the stack trace.



                          Read up on stack traces in "What is a stack trace, and how can I use it to debug my application errors?"



                          I still can't solve my problem!



                          If you've found your Exception and the line where it occurred, and still cannot figure out how to fix it, don't hesitate to ask a question on StackOverflow.



                          Try to be as concise as possible: post the stack trace, and the relevant code (e.g. a few lines up to the line which threw the Exception).






                          share|improve this answer





















                          • 28





                            I know this post is old: but if you use IntelliJ IDEA you can go inside Android > Devices|Logcat and add a new filter (i.imgur.com/145dtkx.png), and filter it for by Log Message here you can put FATAL EXCEPTION (i.imgur.com/HpELhaU.png) so in this Box you can read all Exceptions which are throw by your application. With this you don't need to clear logcat and do the crash again. I think Android Studio have this option too.

                            – Marco Acierno
                            Jun 14 '14 at 14:49








                          • 1





                            Filtering logcat in Eclipse can be done by typing in the java package name in the application name field of the filter.

                            – Stephane
                            Mar 21 '15 at 12:38











                          • I think the main point is understanding the trace back one gets when the exception happens. FCs are a bit bad when there is no trace back or not a usable one, which is where it gets hairy. but I think this explanation is a nice first intro in finding/identifying such bugs.

                            – DooMMasteR
                            Aug 19 '15 at 14:43






                          • 3





                            Things are easy when your logcat has some trace of error, but what in case logcat has nothing? stackoverflow.com/questions/32455645/…

                            – Marian Paździoch
                            Sep 8 '15 at 10:50






                          • 3





                            The problem is the line does not contain the error which is written and pointed by the stack trace.

                            – Hilal
                            Mar 10 '17 at 13:22
















                          636














                          This answer describes the process of retrieving the stack trace. Already have the stack trace? Read up on stack traces in "What is a stack trace, and how can I use it to debug my application errors?"



                          The Problem



                          Your application quit because an uncaught RuntimeException was thrown.

                          The most common of these is the NullPointerException.



                          How to solve it?



                          Every time an Android application crashes (or any Java application for that matter), a Stack trace is written to the console (in this case, logcat). This stack trace contains vital information for solving your problem.



                          Android Studio



                          Finding the stack trace in Android Studio



                          In the bottom bar of the window, click on the Logcat button. Alternatively, you can press alt+6. Make sure your emulator or device is selected in the Devices panel. Next, try to find the stack trace, which is shown in red. There may be a lot of stuff logged into logcat, so you may need to scroll a bit. An easy way to find the stack trace is to clear the logcat (using the recycle bin on the right), and let the app crash again.



                          I have found the stack trace, now what?



                          Yay! You're halfway to solving your problem.

                          You only need to find out what exactly made your application crash, by analyzing the stack trace.



                          Read up on stack traces in "What is a stack trace, and how can I use it to debug my application errors?"



                          I still can't solve my problem!



                          If you've found your Exception and the line where it occurred, and still cannot figure out how to fix it, don't hesitate to ask a question on StackOverflow.



                          Try to be as concise as possible: post the stack trace, and the relevant code (e.g. a few lines up to the line which threw the Exception).






                          share|improve this answer





















                          • 28





                            I know this post is old: but if you use IntelliJ IDEA you can go inside Android > Devices|Logcat and add a new filter (i.imgur.com/145dtkx.png), and filter it for by Log Message here you can put FATAL EXCEPTION (i.imgur.com/HpELhaU.png) so in this Box you can read all Exceptions which are throw by your application. With this you don't need to clear logcat and do the crash again. I think Android Studio have this option too.

                            – Marco Acierno
                            Jun 14 '14 at 14:49








                          • 1





                            Filtering logcat in Eclipse can be done by typing in the java package name in the application name field of the filter.

                            – Stephane
                            Mar 21 '15 at 12:38











                          • I think the main point is understanding the trace back one gets when the exception happens. FCs are a bit bad when there is no trace back or not a usable one, which is where it gets hairy. but I think this explanation is a nice first intro in finding/identifying such bugs.

                            – DooMMasteR
                            Aug 19 '15 at 14:43






                          • 3





                            Things are easy when your logcat has some trace of error, but what in case logcat has nothing? stackoverflow.com/questions/32455645/…

                            – Marian Paździoch
                            Sep 8 '15 at 10:50






                          • 3





                            The problem is the line does not contain the error which is written and pointed by the stack trace.

                            – Hilal
                            Mar 10 '17 at 13:22














                          636












                          636








                          636







                          This answer describes the process of retrieving the stack trace. Already have the stack trace? Read up on stack traces in "What is a stack trace, and how can I use it to debug my application errors?"



                          The Problem



                          Your application quit because an uncaught RuntimeException was thrown.

                          The most common of these is the NullPointerException.



                          How to solve it?



                          Every time an Android application crashes (or any Java application for that matter), a Stack trace is written to the console (in this case, logcat). This stack trace contains vital information for solving your problem.



                          Android Studio



                          Finding the stack trace in Android Studio



                          In the bottom bar of the window, click on the Logcat button. Alternatively, you can press alt+6. Make sure your emulator or device is selected in the Devices panel. Next, try to find the stack trace, which is shown in red. There may be a lot of stuff logged into logcat, so you may need to scroll a bit. An easy way to find the stack trace is to clear the logcat (using the recycle bin on the right), and let the app crash again.



                          I have found the stack trace, now what?



                          Yay! You're halfway to solving your problem.

                          You only need to find out what exactly made your application crash, by analyzing the stack trace.



                          Read up on stack traces in "What is a stack trace, and how can I use it to debug my application errors?"



                          I still can't solve my problem!



                          If you've found your Exception and the line where it occurred, and still cannot figure out how to fix it, don't hesitate to ask a question on StackOverflow.



                          Try to be as concise as possible: post the stack trace, and the relevant code (e.g. a few lines up to the line which threw the Exception).






                          share|improve this answer















                          This answer describes the process of retrieving the stack trace. Already have the stack trace? Read up on stack traces in "What is a stack trace, and how can I use it to debug my application errors?"



                          The Problem



                          Your application quit because an uncaught RuntimeException was thrown.

                          The most common of these is the NullPointerException.



                          How to solve it?



                          Every time an Android application crashes (or any Java application for that matter), a Stack trace is written to the console (in this case, logcat). This stack trace contains vital information for solving your problem.



                          Android Studio



                          Finding the stack trace in Android Studio



                          In the bottom bar of the window, click on the Logcat button. Alternatively, you can press alt+6. Make sure your emulator or device is selected in the Devices panel. Next, try to find the stack trace, which is shown in red. There may be a lot of stuff logged into logcat, so you may need to scroll a bit. An easy way to find the stack trace is to clear the logcat (using the recycle bin on the right), and let the app crash again.



                          I have found the stack trace, now what?



                          Yay! You're halfway to solving your problem.

                          You only need to find out what exactly made your application crash, by analyzing the stack trace.



                          Read up on stack traces in "What is a stack trace, and how can I use it to debug my application errors?"



                          I still can't solve my problem!



                          If you've found your Exception and the line where it occurred, and still cannot figure out how to fix it, don't hesitate to ask a question on StackOverflow.



                          Try to be as concise as possible: post the stack trace, and the relevant code (e.g. a few lines up to the line which threw the Exception).







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Mar 12 '18 at 13:45


























                          community wiki





                          10 revs, 4 users 77%
                          nhaarman









                          • 28





                            I know this post is old: but if you use IntelliJ IDEA you can go inside Android > Devices|Logcat and add a new filter (i.imgur.com/145dtkx.png), and filter it for by Log Message here you can put FATAL EXCEPTION (i.imgur.com/HpELhaU.png) so in this Box you can read all Exceptions which are throw by your application. With this you don't need to clear logcat and do the crash again. I think Android Studio have this option too.

                            – Marco Acierno
                            Jun 14 '14 at 14:49








                          • 1





                            Filtering logcat in Eclipse can be done by typing in the java package name in the application name field of the filter.

                            – Stephane
                            Mar 21 '15 at 12:38











                          • I think the main point is understanding the trace back one gets when the exception happens. FCs are a bit bad when there is no trace back or not a usable one, which is where it gets hairy. but I think this explanation is a nice first intro in finding/identifying such bugs.

                            – DooMMasteR
                            Aug 19 '15 at 14:43






                          • 3





                            Things are easy when your logcat has some trace of error, but what in case logcat has nothing? stackoverflow.com/questions/32455645/…

                            – Marian Paździoch
                            Sep 8 '15 at 10:50






                          • 3





                            The problem is the line does not contain the error which is written and pointed by the stack trace.

                            – Hilal
                            Mar 10 '17 at 13:22














                          • 28





                            I know this post is old: but if you use IntelliJ IDEA you can go inside Android > Devices|Logcat and add a new filter (i.imgur.com/145dtkx.png), and filter it for by Log Message here you can put FATAL EXCEPTION (i.imgur.com/HpELhaU.png) so in this Box you can read all Exceptions which are throw by your application. With this you don't need to clear logcat and do the crash again. I think Android Studio have this option too.

                            – Marco Acierno
                            Jun 14 '14 at 14:49








                          • 1





                            Filtering logcat in Eclipse can be done by typing in the java package name in the application name field of the filter.

                            – Stephane
                            Mar 21 '15 at 12:38











                          • I think the main point is understanding the trace back one gets when the exception happens. FCs are a bit bad when there is no trace back or not a usable one, which is where it gets hairy. but I think this explanation is a nice first intro in finding/identifying such bugs.

                            – DooMMasteR
                            Aug 19 '15 at 14:43






                          • 3





                            Things are easy when your logcat has some trace of error, but what in case logcat has nothing? stackoverflow.com/questions/32455645/…

                            – Marian Paździoch
                            Sep 8 '15 at 10:50






                          • 3





                            The problem is the line does not contain the error which is written and pointed by the stack trace.

                            – Hilal
                            Mar 10 '17 at 13:22








                          28




                          28





                          I know this post is old: but if you use IntelliJ IDEA you can go inside Android > Devices|Logcat and add a new filter (i.imgur.com/145dtkx.png), and filter it for by Log Message here you can put FATAL EXCEPTION (i.imgur.com/HpELhaU.png) so in this Box you can read all Exceptions which are throw by your application. With this you don't need to clear logcat and do the crash again. I think Android Studio have this option too.

                          – Marco Acierno
                          Jun 14 '14 at 14:49







                          I know this post is old: but if you use IntelliJ IDEA you can go inside Android > Devices|Logcat and add a new filter (i.imgur.com/145dtkx.png), and filter it for by Log Message here you can put FATAL EXCEPTION (i.imgur.com/HpELhaU.png) so in this Box you can read all Exceptions which are throw by your application. With this you don't need to clear logcat and do the crash again. I think Android Studio have this option too.

                          – Marco Acierno
                          Jun 14 '14 at 14:49






                          1




                          1





                          Filtering logcat in Eclipse can be done by typing in the java package name in the application name field of the filter.

                          – Stephane
                          Mar 21 '15 at 12:38





                          Filtering logcat in Eclipse can be done by typing in the java package name in the application name field of the filter.

                          – Stephane
                          Mar 21 '15 at 12:38













                          I think the main point is understanding the trace back one gets when the exception happens. FCs are a bit bad when there is no trace back or not a usable one, which is where it gets hairy. but I think this explanation is a nice first intro in finding/identifying such bugs.

                          – DooMMasteR
                          Aug 19 '15 at 14:43





                          I think the main point is understanding the trace back one gets when the exception happens. FCs are a bit bad when there is no trace back or not a usable one, which is where it gets hairy. but I think this explanation is a nice first intro in finding/identifying such bugs.

                          – DooMMasteR
                          Aug 19 '15 at 14:43




                          3




                          3





                          Things are easy when your logcat has some trace of error, but what in case logcat has nothing? stackoverflow.com/questions/32455645/…

                          – Marian Paździoch
                          Sep 8 '15 at 10:50





                          Things are easy when your logcat has some trace of error, but what in case logcat has nothing? stackoverflow.com/questions/32455645/…

                          – Marian Paździoch
                          Sep 8 '15 at 10:50




                          3




                          3





                          The problem is the line does not contain the error which is written and pointed by the stack trace.

                          – Hilal
                          Mar 10 '17 at 13:22





                          The problem is the line does not contain the error which is written and pointed by the stack trace.

                          – Hilal
                          Mar 10 '17 at 13:22













                          92














                          You can use Google's ADB tool to get Logcat file to analyze the issue.



                          adb logcat > logcat.txt


                          open logcat.txt file and search for your application name. There should be information on why it failed, the line number ,Class name etc.






                          share|improve this answer


























                          • This is great, it'll show you quickly anything going on on the device even if your debugger is failing to catch it, which can happen for Xamarin if the runtime fails to load.

                            – jvenema
                            Oct 10 '15 at 18:47






                          • 1





                            I couldn't see why my app was crashing in the android studio logcat, there were no errors at all. This answer gave me what I needed. Later on however I realised that I had some filter on in the studio logcat which was preventing me from seeing the error. I switched back to "Show only selected application" and I was back up and running.

                            – Yannick
                            Oct 30 '15 at 23:47













                          • you should add -d, otherwise you nave to ctrl-C to exit logcat. I do adb logcat -v time -d > filename.txt

                            – Karakuri
                            Dec 6 '16 at 1:35
















                          92














                          You can use Google's ADB tool to get Logcat file to analyze the issue.



                          adb logcat > logcat.txt


                          open logcat.txt file and search for your application name. There should be information on why it failed, the line number ,Class name etc.






                          share|improve this answer


























                          • This is great, it'll show you quickly anything going on on the device even if your debugger is failing to catch it, which can happen for Xamarin if the runtime fails to load.

                            – jvenema
                            Oct 10 '15 at 18:47






                          • 1





                            I couldn't see why my app was crashing in the android studio logcat, there were no errors at all. This answer gave me what I needed. Later on however I realised that I had some filter on in the studio logcat which was preventing me from seeing the error. I switched back to "Show only selected application" and I was back up and running.

                            – Yannick
                            Oct 30 '15 at 23:47













                          • you should add -d, otherwise you nave to ctrl-C to exit logcat. I do adb logcat -v time -d > filename.txt

                            – Karakuri
                            Dec 6 '16 at 1:35














                          92












                          92








                          92







                          You can use Google's ADB tool to get Logcat file to analyze the issue.



                          adb logcat > logcat.txt


                          open logcat.txt file and search for your application name. There should be information on why it failed, the line number ,Class name etc.






                          share|improve this answer















                          You can use Google's ADB tool to get Logcat file to analyze the issue.



                          adb logcat > logcat.txt


                          open logcat.txt file and search for your application name. There should be information on why it failed, the line number ,Class name etc.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Oct 21 '17 at 21:04









                          Keet Sugathadasa

                          688621




                          688621










                          answered Mar 22 '15 at 23:06









                          Vlad BezdenVlad Bezden

                          29.8k10130114




                          29.8k10130114













                          • This is great, it'll show you quickly anything going on on the device even if your debugger is failing to catch it, which can happen for Xamarin if the runtime fails to load.

                            – jvenema
                            Oct 10 '15 at 18:47






                          • 1





                            I couldn't see why my app was crashing in the android studio logcat, there were no errors at all. This answer gave me what I needed. Later on however I realised that I had some filter on in the studio logcat which was preventing me from seeing the error. I switched back to "Show only selected application" and I was back up and running.

                            – Yannick
                            Oct 30 '15 at 23:47













                          • you should add -d, otherwise you nave to ctrl-C to exit logcat. I do adb logcat -v time -d > filename.txt

                            – Karakuri
                            Dec 6 '16 at 1:35



















                          • This is great, it'll show you quickly anything going on on the device even if your debugger is failing to catch it, which can happen for Xamarin if the runtime fails to load.

                            – jvenema
                            Oct 10 '15 at 18:47






                          • 1





                            I couldn't see why my app was crashing in the android studio logcat, there were no errors at all. This answer gave me what I needed. Later on however I realised that I had some filter on in the studio logcat which was preventing me from seeing the error. I switched back to "Show only selected application" and I was back up and running.

                            – Yannick
                            Oct 30 '15 at 23:47













                          • you should add -d, otherwise you nave to ctrl-C to exit logcat. I do adb logcat -v time -d > filename.txt

                            – Karakuri
                            Dec 6 '16 at 1:35

















                          This is great, it'll show you quickly anything going on on the device even if your debugger is failing to catch it, which can happen for Xamarin if the runtime fails to load.

                          – jvenema
                          Oct 10 '15 at 18:47





                          This is great, it'll show you quickly anything going on on the device even if your debugger is failing to catch it, which can happen for Xamarin if the runtime fails to load.

                          – jvenema
                          Oct 10 '15 at 18:47




                          1




                          1





                          I couldn't see why my app was crashing in the android studio logcat, there were no errors at all. This answer gave me what I needed. Later on however I realised that I had some filter on in the studio logcat which was preventing me from seeing the error. I switched back to "Show only selected application" and I was back up and running.

                          – Yannick
                          Oct 30 '15 at 23:47







                          I couldn't see why my app was crashing in the android studio logcat, there were no errors at all. This answer gave me what I needed. Later on however I realised that I had some filter on in the studio logcat which was preventing me from seeing the error. I switched back to "Show only selected application" and I was back up and running.

                          – Yannick
                          Oct 30 '15 at 23:47















                          you should add -d, otherwise you nave to ctrl-C to exit logcat. I do adb logcat -v time -d > filename.txt

                          – Karakuri
                          Dec 6 '16 at 1:35





                          you should add -d, otherwise you nave to ctrl-C to exit logcat. I do adb logcat -v time -d > filename.txt

                          – Karakuri
                          Dec 6 '16 at 1:35











                          31














                          First you check which point your app has crashed (Unfortunately, MyApp has stopped.). For this you can use Log.e("TAG","Message");, using this line you can see you app log in logcat.



                          After that you find which point your app has stopped its very easy to solve at your side.






                          share|improve this answer






























                            31














                            First you check which point your app has crashed (Unfortunately, MyApp has stopped.). For this you can use Log.e("TAG","Message");, using this line you can see you app log in logcat.



                            After that you find which point your app has stopped its very easy to solve at your side.






                            share|improve this answer




























                              31












                              31








                              31







                              First you check which point your app has crashed (Unfortunately, MyApp has stopped.). For this you can use Log.e("TAG","Message");, using this line you can see you app log in logcat.



                              After that you find which point your app has stopped its very easy to solve at your side.






                              share|improve this answer















                              First you check which point your app has crashed (Unfortunately, MyApp has stopped.). For this you can use Log.e("TAG","Message");, using this line you can see you app log in logcat.



                              After that you find which point your app has stopped its very easy to solve at your side.







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited Sep 14 '16 at 4:13









                              Vasily Kabunov

                              3,725113441




                              3,725113441










                              answered Mar 18 '15 at 8:01









                              Hiren VaghelaHiren Vaghela

                              4911619




                              4911619























                                  22














                                  Just check the error in log cat.



                                  You get the log cat option from in eclipse:




                                  window->show view->others->Android->Logcat




                                  Log cat contains error.



                                  Other wise you can also check the error by executing an application in debug mode.
                                  Firstly set breakpoint after that by doing:




                                  right click on project->debug as->Android application







                                  share|improve this answer






























                                    22














                                    Just check the error in log cat.



                                    You get the log cat option from in eclipse:




                                    window->show view->others->Android->Logcat




                                    Log cat contains error.



                                    Other wise you can also check the error by executing an application in debug mode.
                                    Firstly set breakpoint after that by doing:




                                    right click on project->debug as->Android application







                                    share|improve this answer




























                                      22












                                      22








                                      22







                                      Just check the error in log cat.



                                      You get the log cat option from in eclipse:




                                      window->show view->others->Android->Logcat




                                      Log cat contains error.



                                      Other wise you can also check the error by executing an application in debug mode.
                                      Firstly set breakpoint after that by doing:




                                      right click on project->debug as->Android application







                                      share|improve this answer















                                      Just check the error in log cat.



                                      You get the log cat option from in eclipse:




                                      window->show view->others->Android->Logcat




                                      Log cat contains error.



                                      Other wise you can also check the error by executing an application in debug mode.
                                      Firstly set breakpoint after that by doing:




                                      right click on project->debug as->Android application








                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited Nov 21 '15 at 1:18









                                      jiaweizhang

                                      6911725




                                      6911725










                                      answered Jun 11 '15 at 10:58









                                      Rahil AliRahil Ali

                                      638720




                                      638720























                                          20














                                          Note: This answer is using Android Studio 2.2.2



                                          Note 2: I am considering that your device is successfully connected.





                                          The first thing you do when your application crashes is look into the LogCat, at the bottom of Android Studio there's a toolbar with a list of menus:



                                          image



                                          Click on the "Android Monitor" (The one I underlined in the image above. ^)



                                          Now, you'll get something like this:



                                          image



                                          Change "Verbose" to "Error" Now it will only show you logged errors. Don't worry about all these errors (if you got them) now.



                                          image



                                          Ok. Now, do what you did to crash your app. After your app crashes, go to your logcat. You should find a new crash log that has a lot of at:x.x.x: and Caused by: TrumpIsPresidentException for example. Go to that Caused by: statement in your logcat.



                                          image



                                          Next to that Caused By:, there should be the Exception that happened. In my case, it's a RuntimeException and under it there should be a line which contains a blue link such as:



                                          image



                                          If that Caused by: DOESN'T have a line with a blue text somewhere under it, then look for another Caused by: that does.



                                          Click on that blue link. It should take you to where the problem occured. In my case, it was due to this line:



                                          throw new RuntimeException();


                                          So, now I know why it's crashing. It's because I'm throwing the exception myself. This was an obvious error.





                                          However, let's say I got another error:



                                          java.lang.NullPointerException


                                          I checked my logcat, I clicked on the blue link it gave me, and it took me here:



                                          mTextView.setText(myString);


                                          So, now I want to debug. According to this StackOverflow question, a NullPointerException says that something is null.



                                          So, let's find out what is null. There's two possibilities. Either mTextView is null, or myString is null. To find out, before the mTextView.setText(mString) line, I add these two lines:



                                          Log.d("AppDebug","mTextView is null: " + String.valueOf(mTextView == null);
                                          Log.d("AppDebug","myString is null: " + String.valueOf(myString== null);


                                          Now, like we did previously (We changed Verose to Error), we want to change "Error" to "Debug". Since we're logging by debugging. Here's all the Log methods:



                                          Log.
                                          d means Debug
                                          e means error
                                          w means warning
                                          v means verbose
                                          i means information
                                          wtf means "What a terrible failure". This is similar to Log.e


                                          So, since we used Log.d, we're checking in Debug. That's why we changed it to debug.



                                          Notice Log.d has a first parameter,in our case "AppDebug". Click on the "No Filters" drop down menu on the top-right of the logcat. Select "Edit Filter Configuration", give a name to your filter, and in "Log Tag" put "App Debug". Click "OK". Now, you should see two lines in the logcat:



                                          yourPackageNameAndApp: mTextView is null: true
                                          yourPackageNameAndApp: myString is null: false


                                          So now we know that mTextView is null.



                                          I observe my code, now I notice something.



                                          I have private TextView mTextView declared at the top of my class. But, I'm not defining it.



                                          Basically I forgot to do this in my onCreate():



                                          mTextView = (TextView) findViewById(R.id.textview_id_in_xml);


                                          So THAT'S why mTextView is null, because I forgot to tell my app what it is. So I add that line, run my app, and now the app doesn't crash.









                                          share|improve this answer


























                                          • What condition causes TrumpIsPresidentException :) ?

                                            – Vivek Mishra
                                            Mar 29 '17 at 13:02






                                          • 3





                                            @VivekMishra When a wall is built

                                            – Ab_
                                            Mar 29 '17 at 13:15













                                          • This is good information, but using images of the Stack Trace diminishes its usefulness - images can't be searched, can't be copied and pasted, can't be picked up by screen readers, and are more difficult to read. (I didn't downvote, by the way, just pointing that out).

                                            – EJoshuaS
                                            May 18 '18 at 13:23








                                          • 1





                                            @EJoshuaS I didn't say to provide images tho.

                                            – Ab_
                                            Jun 5 '18 at 9:57
















                                          20














                                          Note: This answer is using Android Studio 2.2.2



                                          Note 2: I am considering that your device is successfully connected.





                                          The first thing you do when your application crashes is look into the LogCat, at the bottom of Android Studio there's a toolbar with a list of menus:



                                          image



                                          Click on the "Android Monitor" (The one I underlined in the image above. ^)



                                          Now, you'll get something like this:



                                          image



                                          Change "Verbose" to "Error" Now it will only show you logged errors. Don't worry about all these errors (if you got them) now.



                                          image



                                          Ok. Now, do what you did to crash your app. After your app crashes, go to your logcat. You should find a new crash log that has a lot of at:x.x.x: and Caused by: TrumpIsPresidentException for example. Go to that Caused by: statement in your logcat.



                                          image



                                          Next to that Caused By:, there should be the Exception that happened. In my case, it's a RuntimeException and under it there should be a line which contains a blue link such as:



                                          image



                                          If that Caused by: DOESN'T have a line with a blue text somewhere under it, then look for another Caused by: that does.



                                          Click on that blue link. It should take you to where the problem occured. In my case, it was due to this line:



                                          throw new RuntimeException();


                                          So, now I know why it's crashing. It's because I'm throwing the exception myself. This was an obvious error.





                                          However, let's say I got another error:



                                          java.lang.NullPointerException


                                          I checked my logcat, I clicked on the blue link it gave me, and it took me here:



                                          mTextView.setText(myString);


                                          So, now I want to debug. According to this StackOverflow question, a NullPointerException says that something is null.



                                          So, let's find out what is null. There's two possibilities. Either mTextView is null, or myString is null. To find out, before the mTextView.setText(mString) line, I add these two lines:



                                          Log.d("AppDebug","mTextView is null: " + String.valueOf(mTextView == null);
                                          Log.d("AppDebug","myString is null: " + String.valueOf(myString== null);


                                          Now, like we did previously (We changed Verose to Error), we want to change "Error" to "Debug". Since we're logging by debugging. Here's all the Log methods:



                                          Log.
                                          d means Debug
                                          e means error
                                          w means warning
                                          v means verbose
                                          i means information
                                          wtf means "What a terrible failure". This is similar to Log.e


                                          So, since we used Log.d, we're checking in Debug. That's why we changed it to debug.



                                          Notice Log.d has a first parameter,in our case "AppDebug". Click on the "No Filters" drop down menu on the top-right of the logcat. Select "Edit Filter Configuration", give a name to your filter, and in "Log Tag" put "App Debug". Click "OK". Now, you should see two lines in the logcat:



                                          yourPackageNameAndApp: mTextView is null: true
                                          yourPackageNameAndApp: myString is null: false


                                          So now we know that mTextView is null.



                                          I observe my code, now I notice something.



                                          I have private TextView mTextView declared at the top of my class. But, I'm not defining it.



                                          Basically I forgot to do this in my onCreate():



                                          mTextView = (TextView) findViewById(R.id.textview_id_in_xml);


                                          So THAT'S why mTextView is null, because I forgot to tell my app what it is. So I add that line, run my app, and now the app doesn't crash.









                                          share|improve this answer


























                                          • What condition causes TrumpIsPresidentException :) ?

                                            – Vivek Mishra
                                            Mar 29 '17 at 13:02






                                          • 3





                                            @VivekMishra When a wall is built

                                            – Ab_
                                            Mar 29 '17 at 13:15













                                          • This is good information, but using images of the Stack Trace diminishes its usefulness - images can't be searched, can't be copied and pasted, can't be picked up by screen readers, and are more difficult to read. (I didn't downvote, by the way, just pointing that out).

                                            – EJoshuaS
                                            May 18 '18 at 13:23








                                          • 1





                                            @EJoshuaS I didn't say to provide images tho.

                                            – Ab_
                                            Jun 5 '18 at 9:57














                                          20












                                          20








                                          20







                                          Note: This answer is using Android Studio 2.2.2



                                          Note 2: I am considering that your device is successfully connected.





                                          The first thing you do when your application crashes is look into the LogCat, at the bottom of Android Studio there's a toolbar with a list of menus:



                                          image



                                          Click on the "Android Monitor" (The one I underlined in the image above. ^)



                                          Now, you'll get something like this:



                                          image



                                          Change "Verbose" to "Error" Now it will only show you logged errors. Don't worry about all these errors (if you got them) now.



                                          image



                                          Ok. Now, do what you did to crash your app. After your app crashes, go to your logcat. You should find a new crash log that has a lot of at:x.x.x: and Caused by: TrumpIsPresidentException for example. Go to that Caused by: statement in your logcat.



                                          image



                                          Next to that Caused By:, there should be the Exception that happened. In my case, it's a RuntimeException and under it there should be a line which contains a blue link such as:



                                          image



                                          If that Caused by: DOESN'T have a line with a blue text somewhere under it, then look for another Caused by: that does.



                                          Click on that blue link. It should take you to where the problem occured. In my case, it was due to this line:



                                          throw new RuntimeException();


                                          So, now I know why it's crashing. It's because I'm throwing the exception myself. This was an obvious error.





                                          However, let's say I got another error:



                                          java.lang.NullPointerException


                                          I checked my logcat, I clicked on the blue link it gave me, and it took me here:



                                          mTextView.setText(myString);


                                          So, now I want to debug. According to this StackOverflow question, a NullPointerException says that something is null.



                                          So, let's find out what is null. There's two possibilities. Either mTextView is null, or myString is null. To find out, before the mTextView.setText(mString) line, I add these two lines:



                                          Log.d("AppDebug","mTextView is null: " + String.valueOf(mTextView == null);
                                          Log.d("AppDebug","myString is null: " + String.valueOf(myString== null);


                                          Now, like we did previously (We changed Verose to Error), we want to change "Error" to "Debug". Since we're logging by debugging. Here's all the Log methods:



                                          Log.
                                          d means Debug
                                          e means error
                                          w means warning
                                          v means verbose
                                          i means information
                                          wtf means "What a terrible failure". This is similar to Log.e


                                          So, since we used Log.d, we're checking in Debug. That's why we changed it to debug.



                                          Notice Log.d has a first parameter,in our case "AppDebug". Click on the "No Filters" drop down menu on the top-right of the logcat. Select "Edit Filter Configuration", give a name to your filter, and in "Log Tag" put "App Debug". Click "OK". Now, you should see two lines in the logcat:



                                          yourPackageNameAndApp: mTextView is null: true
                                          yourPackageNameAndApp: myString is null: false


                                          So now we know that mTextView is null.



                                          I observe my code, now I notice something.



                                          I have private TextView mTextView declared at the top of my class. But, I'm not defining it.



                                          Basically I forgot to do this in my onCreate():



                                          mTextView = (TextView) findViewById(R.id.textview_id_in_xml);


                                          So THAT'S why mTextView is null, because I forgot to tell my app what it is. So I add that line, run my app, and now the app doesn't crash.









                                          share|improve this answer















                                          Note: This answer is using Android Studio 2.2.2



                                          Note 2: I am considering that your device is successfully connected.





                                          The first thing you do when your application crashes is look into the LogCat, at the bottom of Android Studio there's a toolbar with a list of menus:



                                          image



                                          Click on the "Android Monitor" (The one I underlined in the image above. ^)



                                          Now, you'll get something like this:



                                          image



                                          Change "Verbose" to "Error" Now it will only show you logged errors. Don't worry about all these errors (if you got them) now.



                                          image



                                          Ok. Now, do what you did to crash your app. After your app crashes, go to your logcat. You should find a new crash log that has a lot of at:x.x.x: and Caused by: TrumpIsPresidentException for example. Go to that Caused by: statement in your logcat.



                                          image



                                          Next to that Caused By:, there should be the Exception that happened. In my case, it's a RuntimeException and under it there should be a line which contains a blue link such as:



                                          image



                                          If that Caused by: DOESN'T have a line with a blue text somewhere under it, then look for another Caused by: that does.



                                          Click on that blue link. It should take you to where the problem occured. In my case, it was due to this line:



                                          throw new RuntimeException();


                                          So, now I know why it's crashing. It's because I'm throwing the exception myself. This was an obvious error.





                                          However, let's say I got another error:



                                          java.lang.NullPointerException


                                          I checked my logcat, I clicked on the blue link it gave me, and it took me here:



                                          mTextView.setText(myString);


                                          So, now I want to debug. According to this StackOverflow question, a NullPointerException says that something is null.



                                          So, let's find out what is null. There's two possibilities. Either mTextView is null, or myString is null. To find out, before the mTextView.setText(mString) line, I add these two lines:



                                          Log.d("AppDebug","mTextView is null: " + String.valueOf(mTextView == null);
                                          Log.d("AppDebug","myString is null: " + String.valueOf(myString== null);


                                          Now, like we did previously (We changed Verose to Error), we want to change "Error" to "Debug". Since we're logging by debugging. Here's all the Log methods:



                                          Log.
                                          d means Debug
                                          e means error
                                          w means warning
                                          v means verbose
                                          i means information
                                          wtf means "What a terrible failure". This is similar to Log.e


                                          So, since we used Log.d, we're checking in Debug. That's why we changed it to debug.



                                          Notice Log.d has a first parameter,in our case "AppDebug". Click on the "No Filters" drop down menu on the top-right of the logcat. Select "Edit Filter Configuration", give a name to your filter, and in "Log Tag" put "App Debug". Click "OK". Now, you should see two lines in the logcat:



                                          yourPackageNameAndApp: mTextView is null: true
                                          yourPackageNameAndApp: myString is null: false


                                          So now we know that mTextView is null.



                                          I observe my code, now I notice something.



                                          I have private TextView mTextView declared at the top of my class. But, I'm not defining it.



                                          Basically I forgot to do this in my onCreate():



                                          mTextView = (TextView) findViewById(R.id.textview_id_in_xml);


                                          So THAT'S why mTextView is null, because I forgot to tell my app what it is. So I add that line, run my app, and now the app doesn't crash.










                                          share|improve this answer














                                          share|improve this answer



                                          share|improve this answer








                                          edited May 23 '17 at 12:10









                                          Community

                                          11




                                          11










                                          answered Nov 6 '16 at 9:23









                                          Ab_Ab_

                                          2,49042665




                                          2,49042665













                                          • What condition causes TrumpIsPresidentException :) ?

                                            – Vivek Mishra
                                            Mar 29 '17 at 13:02






                                          • 3





                                            @VivekMishra When a wall is built

                                            – Ab_
                                            Mar 29 '17 at 13:15













                                          • This is good information, but using images of the Stack Trace diminishes its usefulness - images can't be searched, can't be copied and pasted, can't be picked up by screen readers, and are more difficult to read. (I didn't downvote, by the way, just pointing that out).

                                            – EJoshuaS
                                            May 18 '18 at 13:23








                                          • 1





                                            @EJoshuaS I didn't say to provide images tho.

                                            – Ab_
                                            Jun 5 '18 at 9:57



















                                          • What condition causes TrumpIsPresidentException :) ?

                                            – Vivek Mishra
                                            Mar 29 '17 at 13:02






                                          • 3





                                            @VivekMishra When a wall is built

                                            – Ab_
                                            Mar 29 '17 at 13:15













                                          • This is good information, but using images of the Stack Trace diminishes its usefulness - images can't be searched, can't be copied and pasted, can't be picked up by screen readers, and are more difficult to read. (I didn't downvote, by the way, just pointing that out).

                                            – EJoshuaS
                                            May 18 '18 at 13:23








                                          • 1





                                            @EJoshuaS I didn't say to provide images tho.

                                            – Ab_
                                            Jun 5 '18 at 9:57

















                                          What condition causes TrumpIsPresidentException :) ?

                                          – Vivek Mishra
                                          Mar 29 '17 at 13:02





                                          What condition causes TrumpIsPresidentException :) ?

                                          – Vivek Mishra
                                          Mar 29 '17 at 13:02




                                          3




                                          3





                                          @VivekMishra When a wall is built

                                          – Ab_
                                          Mar 29 '17 at 13:15







                                          @VivekMishra When a wall is built

                                          – Ab_
                                          Mar 29 '17 at 13:15















                                          This is good information, but using images of the Stack Trace diminishes its usefulness - images can't be searched, can't be copied and pasted, can't be picked up by screen readers, and are more difficult to read. (I didn't downvote, by the way, just pointing that out).

                                          – EJoshuaS
                                          May 18 '18 at 13:23







                                          This is good information, but using images of the Stack Trace diminishes its usefulness - images can't be searched, can't be copied and pasted, can't be picked up by screen readers, and are more difficult to read. (I didn't downvote, by the way, just pointing that out).

                                          – EJoshuaS
                                          May 18 '18 at 13:23






                                          1




                                          1





                                          @EJoshuaS I didn't say to provide images tho.

                                          – Ab_
                                          Jun 5 '18 at 9:57





                                          @EJoshuaS I didn't say to provide images tho.

                                          – Ab_
                                          Jun 5 '18 at 9:57











                                          13














                                          This popup shows only when you get a fatal exception in your code which stops the execution of the app. It could be any exception NullPointerException, OutOfMemoryException etc.



                                          Best way to check is through Logcat if you are still developing the app in Android studio which is quick way to read stack trace and check the cause of the app.



                                          If your app is already live, then you can not use logcat. So, for that you can implement Crashlytics to provide you bug reports of any exception that occurs.






                                          share|improve this answer






























                                            13














                                            This popup shows only when you get a fatal exception in your code which stops the execution of the app. It could be any exception NullPointerException, OutOfMemoryException etc.



                                            Best way to check is through Logcat if you are still developing the app in Android studio which is quick way to read stack trace and check the cause of the app.



                                            If your app is already live, then you can not use logcat. So, for that you can implement Crashlytics to provide you bug reports of any exception that occurs.






                                            share|improve this answer




























                                              13












                                              13








                                              13







                                              This popup shows only when you get a fatal exception in your code which stops the execution of the app. It could be any exception NullPointerException, OutOfMemoryException etc.



                                              Best way to check is through Logcat if you are still developing the app in Android studio which is quick way to read stack trace and check the cause of the app.



                                              If your app is already live, then you can not use logcat. So, for that you can implement Crashlytics to provide you bug reports of any exception that occurs.






                                              share|improve this answer















                                              This popup shows only when you get a fatal exception in your code which stops the execution of the app. It could be any exception NullPointerException, OutOfMemoryException etc.



                                              Best way to check is through Logcat if you are still developing the app in Android studio which is quick way to read stack trace and check the cause of the app.



                                              If your app is already live, then you can not use logcat. So, for that you can implement Crashlytics to provide you bug reports of any exception that occurs.







                                              share|improve this answer














                                              share|improve this answer



                                              share|improve this answer








                                              edited Feb 7 at 13:31









                                              ppreetikaa

                                              4191515




                                              4191515










                                              answered Jul 4 '17 at 4:38









                                              AniAni

                                              761414




                                              761414























                                                  11














                                                  Check your Logcat message and see your Manifest file. There should be something missing like defining the Activity,User permission`, etc.






                                                  share|improve this answer






























                                                    11














                                                    Check your Logcat message and see your Manifest file. There should be something missing like defining the Activity,User permission`, etc.






                                                    share|improve this answer




























                                                      11












                                                      11








                                                      11







                                                      Check your Logcat message and see your Manifest file. There should be something missing like defining the Activity,User permission`, etc.






                                                      share|improve this answer















                                                      Check your Logcat message and see your Manifest file. There should be something missing like defining the Activity,User permission`, etc.







                                                      share|improve this answer














                                                      share|improve this answer



                                                      share|improve this answer








                                                      edited Dec 15 '16 at 12:35









                                                      Satan Pandeya

                                                      2,43231633




                                                      2,43231633










                                                      answered Jun 29 '15 at 11:48









                                                      Manoj ahirwarManoj ahirwar

                                                      512517




                                                      512517























                                                          10














                                                          You can use any of these tools:





                                                          1. adb logcat


                                                          2. adb logcat > logs.txt (you can use editors to open and search errors.)


                                                          3. eclipse logcat (If not visible in eclipse, Go to Windows->Show View->Others->Android->LogCat)


                                                          4. Android Debug Monitor or Android Device Monitor(type command monitor or open through UI)




                                                          enter image description here





                                                          1. Android Studio




                                                          I suggest to use Android Debug Monitor, it is good. Because eclipse hangs when too many logs are there, and through adb logcat filter and all difficult.






                                                          share|improve this answer






























                                                            10














                                                            You can use any of these tools:





                                                            1. adb logcat


                                                            2. adb logcat > logs.txt (you can use editors to open and search errors.)


                                                            3. eclipse logcat (If not visible in eclipse, Go to Windows->Show View->Others->Android->LogCat)


                                                            4. Android Debug Monitor or Android Device Monitor(type command monitor or open through UI)




                                                            enter image description here





                                                            1. Android Studio




                                                            I suggest to use Android Debug Monitor, it is good. Because eclipse hangs when too many logs are there, and through adb logcat filter and all difficult.






                                                            share|improve this answer




























                                                              10












                                                              10








                                                              10







                                                              You can use any of these tools:





                                                              1. adb logcat


                                                              2. adb logcat > logs.txt (you can use editors to open and search errors.)


                                                              3. eclipse logcat (If not visible in eclipse, Go to Windows->Show View->Others->Android->LogCat)


                                                              4. Android Debug Monitor or Android Device Monitor(type command monitor or open through UI)




                                                              enter image description here





                                                              1. Android Studio




                                                              I suggest to use Android Debug Monitor, it is good. Because eclipse hangs when too many logs are there, and through adb logcat filter and all difficult.






                                                              share|improve this answer















                                                              You can use any of these tools:





                                                              1. adb logcat


                                                              2. adb logcat > logs.txt (you can use editors to open and search errors.)


                                                              3. eclipse logcat (If not visible in eclipse, Go to Windows->Show View->Others->Android->LogCat)


                                                              4. Android Debug Monitor or Android Device Monitor(type command monitor or open through UI)




                                                              enter image description here





                                                              1. Android Studio




                                                              I suggest to use Android Debug Monitor, it is good. Because eclipse hangs when too many logs are there, and through adb logcat filter and all difficult.







                                                              share|improve this answer














                                                              share|improve this answer



                                                              share|improve this answer








                                                              edited Jul 7 '16 at 10:38

























                                                              answered Nov 3 '15 at 5:47









                                                              ShivBuyyaShivBuyya

                                                              9041212




                                                              9041212























                                                                  8














                                                                  You have to check the Stack trace



                                                                  How to do that?



                                                                  on Your IDE Check the windows form LOGCAT



                                                                  If you cant see the logcat windows go to this path and open it



                                                                  window->show view->others->Android->Logcat


                                                                  if you are using Google-Api go to this path



                                                                  adb logcat > logcat.txt






                                                                  share|improve this answer




























                                                                    8














                                                                    You have to check the Stack trace



                                                                    How to do that?



                                                                    on Your IDE Check the windows form LOGCAT



                                                                    If you cant see the logcat windows go to this path and open it



                                                                    window->show view->others->Android->Logcat


                                                                    if you are using Google-Api go to this path



                                                                    adb logcat > logcat.txt






                                                                    share|improve this answer


























                                                                      8












                                                                      8








                                                                      8







                                                                      You have to check the Stack trace



                                                                      How to do that?



                                                                      on Your IDE Check the windows form LOGCAT



                                                                      If you cant see the logcat windows go to this path and open it



                                                                      window->show view->others->Android->Logcat


                                                                      if you are using Google-Api go to this path



                                                                      adb logcat > logcat.txt






                                                                      share|improve this answer













                                                                      You have to check the Stack trace



                                                                      How to do that?



                                                                      on Your IDE Check the windows form LOGCAT



                                                                      If you cant see the logcat windows go to this path and open it



                                                                      window->show view->others->Android->Logcat


                                                                      if you are using Google-Api go to this path



                                                                      adb logcat > logcat.txt







                                                                      share|improve this answer












                                                                      share|improve this answer



                                                                      share|improve this answer










                                                                      answered Jul 13 '15 at 8:37









                                                                      alireza aminialireza amini

                                                                      1,09111028




                                                                      1,09111028























                                                                          7














                                                                          Let me share a basic Logcat analysis for when you meet a Force Close (when app stops working).



                                                                          DOCS



                                                                          Basic tool from Android to collect/analyse logs is the logcat.



                                                                          HERE is the Android's page about logcat



                                                                          If you use android Studio, you can also check this LINK.



                                                                          Capturing



                                                                          Basically, you can MANUALLY capture logcat with following command (or just check AndroidMonitor window in AndroidStudio):



                                                                          adb logcat


                                                                          There's a lot of parameters you can add to command which helps you to filter and display the message that you want... This is personal... I always use the command below to get the message timestamp:



                                                                          adb logcat -v time


                                                                          You can redirect the output to a file and analyze it in a Text Editor.



                                                                          Analyzing



                                                                          If you app is Crashing, you'll get something like:



                                                                          07-09 08:29:13.474 21144-21144/com.example.khan.abc D/AndroidRuntime: Shutting down VM
                                                                          07-09 08:29:13.475 21144-21144/com.example.khan.abc E/AndroidRuntime: FATAL EXCEPTION: main
                                                                          Process: com.example.khan.abc, PID: 21144
                                                                          java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v4.app.FragmentActivity.onBackPressed()' on a null object reference
                                                                          at com.example.khan.abc.AudioFragment$1.onClick(AudioFragment.java:125)
                                                                          at android.view.View.performClick(View.java:4848)
                                                                          at android.view.View$PerformClick.run(View.java:20262)
                                                                          at android.os.Handler.handleCallback(Handler.java:815)
                                                                          at android.os.Handler.dispatchMessage(Handler.java:104)
                                                                          at android.os.Looper.loop(Looper.java:194)
                                                                          at android.app.ActivityThread.main(ActivityThread.java:5631)
                                                                          at java.lang.reflect.Method.invoke(Native Method)
                                                                          at java.lang.reflect.Method.invoke(Method.java:372)
                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
                                                                          07-09 08:29:15.195 21144-21144/com.example.khan.abc I/Process: Sending signal. PID: 21144 SIG: 9


                                                                          This part of the log shows you a lot of information:




                                                                          • When the issue happened: 07-09 08:29:13.475


                                                                          It is important to check when the issue happened... You may find several errors in a log... you must be sure that you are checking the proper messages :)




                                                                          • Which app crashed: com.example.khan.abc


                                                                          This way, you know which app crashed (to be sure that you are checking the logs about your message)




                                                                          • Which ERROR: java.lang.NullPointerException


                                                                          A NULL Pointer Exception error




                                                                          • Detailed info about the error: Attempt to invoke virtual method 'void android.support.v4.app.FragmentActivity.onBackPressed()' on a null object reference


                                                                          You tried to call method onBackPressed() from a FragmentActivity object. However, that object was null when you did it.





                                                                          • Stack Trace: Stack Trace shows you the method invocation order... Sometimes, the error happens in the calling method (and not in the called method).



                                                                            at com.example.khan.abc.AudioFragment$1.onClick(AudioFragment.java:125)




                                                                          Error happened in file com.example.khan.abc.AudioFragment.java, inside onClick() method at line: 125 (stacktrace shows the line that error happened)



                                                                          It was called by:



                                                                          at android.view.View.performClick(View.java:4848)


                                                                          Which was called by:



                                                                          at android.view.View$PerformClick.run(View.java:20262)


                                                                          which was called by:



                                                                          at android.os.Handler.handleCallback(Handler.java:815)


                                                                          etc....



                                                                          Overview



                                                                          This was just an overview... Not all logs are simple etc... It is just to share the idea and provide a entry-level information to you...



                                                                          I hope I could help you someway...
                                                                          Regards






                                                                          share|improve this answer




























                                                                            7














                                                                            Let me share a basic Logcat analysis for when you meet a Force Close (when app stops working).



                                                                            DOCS



                                                                            Basic tool from Android to collect/analyse logs is the logcat.



                                                                            HERE is the Android's page about logcat



                                                                            If you use android Studio, you can also check this LINK.



                                                                            Capturing



                                                                            Basically, you can MANUALLY capture logcat with following command (or just check AndroidMonitor window in AndroidStudio):



                                                                            adb logcat


                                                                            There's a lot of parameters you can add to command which helps you to filter and display the message that you want... This is personal... I always use the command below to get the message timestamp:



                                                                            adb logcat -v time


                                                                            You can redirect the output to a file and analyze it in a Text Editor.



                                                                            Analyzing



                                                                            If you app is Crashing, you'll get something like:



                                                                            07-09 08:29:13.474 21144-21144/com.example.khan.abc D/AndroidRuntime: Shutting down VM
                                                                            07-09 08:29:13.475 21144-21144/com.example.khan.abc E/AndroidRuntime: FATAL EXCEPTION: main
                                                                            Process: com.example.khan.abc, PID: 21144
                                                                            java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v4.app.FragmentActivity.onBackPressed()' on a null object reference
                                                                            at com.example.khan.abc.AudioFragment$1.onClick(AudioFragment.java:125)
                                                                            at android.view.View.performClick(View.java:4848)
                                                                            at android.view.View$PerformClick.run(View.java:20262)
                                                                            at android.os.Handler.handleCallback(Handler.java:815)
                                                                            at android.os.Handler.dispatchMessage(Handler.java:104)
                                                                            at android.os.Looper.loop(Looper.java:194)
                                                                            at android.app.ActivityThread.main(ActivityThread.java:5631)
                                                                            at java.lang.reflect.Method.invoke(Native Method)
                                                                            at java.lang.reflect.Method.invoke(Method.java:372)
                                                                            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
                                                                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
                                                                            07-09 08:29:15.195 21144-21144/com.example.khan.abc I/Process: Sending signal. PID: 21144 SIG: 9


                                                                            This part of the log shows you a lot of information:




                                                                            • When the issue happened: 07-09 08:29:13.475


                                                                            It is important to check when the issue happened... You may find several errors in a log... you must be sure that you are checking the proper messages :)




                                                                            • Which app crashed: com.example.khan.abc


                                                                            This way, you know which app crashed (to be sure that you are checking the logs about your message)




                                                                            • Which ERROR: java.lang.NullPointerException


                                                                            A NULL Pointer Exception error




                                                                            • Detailed info about the error: Attempt to invoke virtual method 'void android.support.v4.app.FragmentActivity.onBackPressed()' on a null object reference


                                                                            You tried to call method onBackPressed() from a FragmentActivity object. However, that object was null when you did it.





                                                                            • Stack Trace: Stack Trace shows you the method invocation order... Sometimes, the error happens in the calling method (and not in the called method).



                                                                              at com.example.khan.abc.AudioFragment$1.onClick(AudioFragment.java:125)




                                                                            Error happened in file com.example.khan.abc.AudioFragment.java, inside onClick() method at line: 125 (stacktrace shows the line that error happened)



                                                                            It was called by:



                                                                            at android.view.View.performClick(View.java:4848)


                                                                            Which was called by:



                                                                            at android.view.View$PerformClick.run(View.java:20262)


                                                                            which was called by:



                                                                            at android.os.Handler.handleCallback(Handler.java:815)


                                                                            etc....



                                                                            Overview



                                                                            This was just an overview... Not all logs are simple etc... It is just to share the idea and provide a entry-level information to you...



                                                                            I hope I could help you someway...
                                                                            Regards






                                                                            share|improve this answer


























                                                                              7












                                                                              7








                                                                              7







                                                                              Let me share a basic Logcat analysis for when you meet a Force Close (when app stops working).



                                                                              DOCS



                                                                              Basic tool from Android to collect/analyse logs is the logcat.



                                                                              HERE is the Android's page about logcat



                                                                              If you use android Studio, you can also check this LINK.



                                                                              Capturing



                                                                              Basically, you can MANUALLY capture logcat with following command (or just check AndroidMonitor window in AndroidStudio):



                                                                              adb logcat


                                                                              There's a lot of parameters you can add to command which helps you to filter and display the message that you want... This is personal... I always use the command below to get the message timestamp:



                                                                              adb logcat -v time


                                                                              You can redirect the output to a file and analyze it in a Text Editor.



                                                                              Analyzing



                                                                              If you app is Crashing, you'll get something like:



                                                                              07-09 08:29:13.474 21144-21144/com.example.khan.abc D/AndroidRuntime: Shutting down VM
                                                                              07-09 08:29:13.475 21144-21144/com.example.khan.abc E/AndroidRuntime: FATAL EXCEPTION: main
                                                                              Process: com.example.khan.abc, PID: 21144
                                                                              java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v4.app.FragmentActivity.onBackPressed()' on a null object reference
                                                                              at com.example.khan.abc.AudioFragment$1.onClick(AudioFragment.java:125)
                                                                              at android.view.View.performClick(View.java:4848)
                                                                              at android.view.View$PerformClick.run(View.java:20262)
                                                                              at android.os.Handler.handleCallback(Handler.java:815)
                                                                              at android.os.Handler.dispatchMessage(Handler.java:104)
                                                                              at android.os.Looper.loop(Looper.java:194)
                                                                              at android.app.ActivityThread.main(ActivityThread.java:5631)
                                                                              at java.lang.reflect.Method.invoke(Native Method)
                                                                              at java.lang.reflect.Method.invoke(Method.java:372)
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
                                                                              07-09 08:29:15.195 21144-21144/com.example.khan.abc I/Process: Sending signal. PID: 21144 SIG: 9


                                                                              This part of the log shows you a lot of information:




                                                                              • When the issue happened: 07-09 08:29:13.475


                                                                              It is important to check when the issue happened... You may find several errors in a log... you must be sure that you are checking the proper messages :)




                                                                              • Which app crashed: com.example.khan.abc


                                                                              This way, you know which app crashed (to be sure that you are checking the logs about your message)




                                                                              • Which ERROR: java.lang.NullPointerException


                                                                              A NULL Pointer Exception error




                                                                              • Detailed info about the error: Attempt to invoke virtual method 'void android.support.v4.app.FragmentActivity.onBackPressed()' on a null object reference


                                                                              You tried to call method onBackPressed() from a FragmentActivity object. However, that object was null when you did it.





                                                                              • Stack Trace: Stack Trace shows you the method invocation order... Sometimes, the error happens in the calling method (and not in the called method).



                                                                                at com.example.khan.abc.AudioFragment$1.onClick(AudioFragment.java:125)




                                                                              Error happened in file com.example.khan.abc.AudioFragment.java, inside onClick() method at line: 125 (stacktrace shows the line that error happened)



                                                                              It was called by:



                                                                              at android.view.View.performClick(View.java:4848)


                                                                              Which was called by:



                                                                              at android.view.View$PerformClick.run(View.java:20262)


                                                                              which was called by:



                                                                              at android.os.Handler.handleCallback(Handler.java:815)


                                                                              etc....



                                                                              Overview



                                                                              This was just an overview... Not all logs are simple etc... It is just to share the idea and provide a entry-level information to you...



                                                                              I hope I could help you someway...
                                                                              Regards






                                                                              share|improve this answer













                                                                              Let me share a basic Logcat analysis for when you meet a Force Close (when app stops working).



                                                                              DOCS



                                                                              Basic tool from Android to collect/analyse logs is the logcat.



                                                                              HERE is the Android's page about logcat



                                                                              If you use android Studio, you can also check this LINK.



                                                                              Capturing



                                                                              Basically, you can MANUALLY capture logcat with following command (or just check AndroidMonitor window in AndroidStudio):



                                                                              adb logcat


                                                                              There's a lot of parameters you can add to command which helps you to filter and display the message that you want... This is personal... I always use the command below to get the message timestamp:



                                                                              adb logcat -v time


                                                                              You can redirect the output to a file and analyze it in a Text Editor.



                                                                              Analyzing



                                                                              If you app is Crashing, you'll get something like:



                                                                              07-09 08:29:13.474 21144-21144/com.example.khan.abc D/AndroidRuntime: Shutting down VM
                                                                              07-09 08:29:13.475 21144-21144/com.example.khan.abc E/AndroidRuntime: FATAL EXCEPTION: main
                                                                              Process: com.example.khan.abc, PID: 21144
                                                                              java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v4.app.FragmentActivity.onBackPressed()' on a null object reference
                                                                              at com.example.khan.abc.AudioFragment$1.onClick(AudioFragment.java:125)
                                                                              at android.view.View.performClick(View.java:4848)
                                                                              at android.view.View$PerformClick.run(View.java:20262)
                                                                              at android.os.Handler.handleCallback(Handler.java:815)
                                                                              at android.os.Handler.dispatchMessage(Handler.java:104)
                                                                              at android.os.Looper.loop(Looper.java:194)
                                                                              at android.app.ActivityThread.main(ActivityThread.java:5631)
                                                                              at java.lang.reflect.Method.invoke(Native Method)
                                                                              at java.lang.reflect.Method.invoke(Method.java:372)
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
                                                                              07-09 08:29:15.195 21144-21144/com.example.khan.abc I/Process: Sending signal. PID: 21144 SIG: 9


                                                                              This part of the log shows you a lot of information:




                                                                              • When the issue happened: 07-09 08:29:13.475


                                                                              It is important to check when the issue happened... You may find several errors in a log... you must be sure that you are checking the proper messages :)




                                                                              • Which app crashed: com.example.khan.abc


                                                                              This way, you know which app crashed (to be sure that you are checking the logs about your message)




                                                                              • Which ERROR: java.lang.NullPointerException


                                                                              A NULL Pointer Exception error




                                                                              • Detailed info about the error: Attempt to invoke virtual method 'void android.support.v4.app.FragmentActivity.onBackPressed()' on a null object reference


                                                                              You tried to call method onBackPressed() from a FragmentActivity object. However, that object was null when you did it.





                                                                              • Stack Trace: Stack Trace shows you the method invocation order... Sometimes, the error happens in the calling method (and not in the called method).



                                                                                at com.example.khan.abc.AudioFragment$1.onClick(AudioFragment.java:125)




                                                                              Error happened in file com.example.khan.abc.AudioFragment.java, inside onClick() method at line: 125 (stacktrace shows the line that error happened)



                                                                              It was called by:



                                                                              at android.view.View.performClick(View.java:4848)


                                                                              Which was called by:



                                                                              at android.view.View$PerformClick.run(View.java:20262)


                                                                              which was called by:



                                                                              at android.os.Handler.handleCallback(Handler.java:815)


                                                                              etc....



                                                                              Overview



                                                                              This was just an overview... Not all logs are simple etc... It is just to share the idea and provide a entry-level information to you...



                                                                              I hope I could help you someway...
                                                                              Regards







                                                                              share|improve this answer












                                                                              share|improve this answer



                                                                              share|improve this answer










                                                                              answered Jul 14 '16 at 3:21









                                                                              W0rmH0leW0rmH0le

                                                                              9,91753549




                                                                              9,91753549























                                                                                  7














                                                                                  In below showToast() method you have to pass another parameter for context or application context by doing so you can try it.



                                                                                    public void showToast(String error, Context applicationContext){
                                                                                  LayoutInflater inflater = getLayoutInflater();
                                                                                  View view = inflater.inflate(R.layout.custom_toast, (ViewGroup)
                                                                                  findViewById(R.id.toast_root));
                                                                                  TextView text = (TextView) findViewById(R.id.toast_error);
                                                                                  text.setText(error);
                                                                                  Toast toast = new Toast(applicationContext);
                                                                                  toast.setGravity(Gravity.TOP | Gravity.FILL_HORIZONTAL, 0, 0);
                                                                                  toast.setDuration(Toast.LENGTH_SHORT);
                                                                                  toast.setView(view);
                                                                                  toast.show();
                                                                                  }





                                                                                  share|improve this answer






























                                                                                    7














                                                                                    In below showToast() method you have to pass another parameter for context or application context by doing so you can try it.



                                                                                      public void showToast(String error, Context applicationContext){
                                                                                    LayoutInflater inflater = getLayoutInflater();
                                                                                    View view = inflater.inflate(R.layout.custom_toast, (ViewGroup)
                                                                                    findViewById(R.id.toast_root));
                                                                                    TextView text = (TextView) findViewById(R.id.toast_error);
                                                                                    text.setText(error);
                                                                                    Toast toast = new Toast(applicationContext);
                                                                                    toast.setGravity(Gravity.TOP | Gravity.FILL_HORIZONTAL, 0, 0);
                                                                                    toast.setDuration(Toast.LENGTH_SHORT);
                                                                                    toast.setView(view);
                                                                                    toast.show();
                                                                                    }





                                                                                    share|improve this answer




























                                                                                      7












                                                                                      7








                                                                                      7







                                                                                      In below showToast() method you have to pass another parameter for context or application context by doing so you can try it.



                                                                                        public void showToast(String error, Context applicationContext){
                                                                                      LayoutInflater inflater = getLayoutInflater();
                                                                                      View view = inflater.inflate(R.layout.custom_toast, (ViewGroup)
                                                                                      findViewById(R.id.toast_root));
                                                                                      TextView text = (TextView) findViewById(R.id.toast_error);
                                                                                      text.setText(error);
                                                                                      Toast toast = new Toast(applicationContext);
                                                                                      toast.setGravity(Gravity.TOP | Gravity.FILL_HORIZONTAL, 0, 0);
                                                                                      toast.setDuration(Toast.LENGTH_SHORT);
                                                                                      toast.setView(view);
                                                                                      toast.show();
                                                                                      }





                                                                                      share|improve this answer















                                                                                      In below showToast() method you have to pass another parameter for context or application context by doing so you can try it.



                                                                                        public void showToast(String error, Context applicationContext){
                                                                                      LayoutInflater inflater = getLayoutInflater();
                                                                                      View view = inflater.inflate(R.layout.custom_toast, (ViewGroup)
                                                                                      findViewById(R.id.toast_root));
                                                                                      TextView text = (TextView) findViewById(R.id.toast_error);
                                                                                      text.setText(error);
                                                                                      Toast toast = new Toast(applicationContext);
                                                                                      toast.setGravity(Gravity.TOP | Gravity.FILL_HORIZONTAL, 0, 0);
                                                                                      toast.setDuration(Toast.LENGTH_SHORT);
                                                                                      toast.setView(view);
                                                                                      toast.show();
                                                                                      }






                                                                                      share|improve this answer














                                                                                      share|improve this answer



                                                                                      share|improve this answer








                                                                                      edited May 24 '17 at 14:48









                                                                                      John Joe

                                                                                      4,76122260




                                                                                      4,76122260










                                                                                      answered Apr 3 '17 at 9:37









                                                                                      Mayank NemaMayank Nema

                                                                                      11516




                                                                                      11516























                                                                                          6














                                                                                          Use the LogCat and try to find what is causing the app to crash.



                                                                                          To see Logcat if you use Android Studio then Press ALT + 6
                                                                                          or



                                                                                          if you use Eclipse then
                                                                                          Window -> Open Perspective -> Other - LogCat



                                                                                          Go to the LogCat, from the drop down menu select error. This will contain all the required information to help you debug. If that doesn't help, post the LogCat as an edit to your question and somebody will help you out.






                                                                                          share|improve this answer




























                                                                                            6














                                                                                            Use the LogCat and try to find what is causing the app to crash.



                                                                                            To see Logcat if you use Android Studio then Press ALT + 6
                                                                                            or



                                                                                            if you use Eclipse then
                                                                                            Window -> Open Perspective -> Other - LogCat



                                                                                            Go to the LogCat, from the drop down menu select error. This will contain all the required information to help you debug. If that doesn't help, post the LogCat as an edit to your question and somebody will help you out.






                                                                                            share|improve this answer


























                                                                                              6












                                                                                              6








                                                                                              6







                                                                                              Use the LogCat and try to find what is causing the app to crash.



                                                                                              To see Logcat if you use Android Studio then Press ALT + 6
                                                                                              or



                                                                                              if you use Eclipse then
                                                                                              Window -> Open Perspective -> Other - LogCat



                                                                                              Go to the LogCat, from the drop down menu select error. This will contain all the required information to help you debug. If that doesn't help, post the LogCat as an edit to your question and somebody will help you out.






                                                                                              share|improve this answer













                                                                                              Use the LogCat and try to find what is causing the app to crash.



                                                                                              To see Logcat if you use Android Studio then Press ALT + 6
                                                                                              or



                                                                                              if you use Eclipse then
                                                                                              Window -> Open Perspective -> Other - LogCat



                                                                                              Go to the LogCat, from the drop down menu select error. This will contain all the required information to help you debug. If that doesn't help, post the LogCat as an edit to your question and somebody will help you out.







                                                                                              share|improve this answer












                                                                                              share|improve this answer



                                                                                              share|improve this answer










                                                                                              answered May 15 '16 at 7:45









                                                                                              Biswajit KarmakarBiswajit Karmakar

                                                                                              7,05132535




                                                                                              7,05132535























                                                                                                  4














                                                                                                  If your app for some reason crashes without good stacktrace. Try debug it from first line, and go line by line until crash. Then you will have answer, which line is causing you trouble. Proably you could then wrapp it into try catch block and print error output.






                                                                                                  share|improve this answer




























                                                                                                    4














                                                                                                    If your app for some reason crashes without good stacktrace. Try debug it from first line, and go line by line until crash. Then you will have answer, which line is causing you trouble. Proably you could then wrapp it into try catch block and print error output.






                                                                                                    share|improve this answer


























                                                                                                      4












                                                                                                      4








                                                                                                      4







                                                                                                      If your app for some reason crashes without good stacktrace. Try debug it from first line, and go line by line until crash. Then you will have answer, which line is causing you trouble. Proably you could then wrapp it into try catch block and print error output.






                                                                                                      share|improve this answer













                                                                                                      If your app for some reason crashes without good stacktrace. Try debug it from first line, and go line by line until crash. Then you will have answer, which line is causing you trouble. Proably you could then wrapp it into try catch block and print error output.







                                                                                                      share|improve this answer












                                                                                                      share|improve this answer



                                                                                                      share|improve this answer










                                                                                                      answered Oct 2 '17 at 15:07









                                                                                                      felislynx.silaefelislynx.silae

                                                                                                      8133




                                                                                                      8133























                                                                                                          3














                                                                                                          You can also get this error message on its own, without any stack trace or any further error message.



                                                                                                          In this case you need to make sure your Android manifest is configured correctly (including any manifest merging happening from a library and any activity that would come from a library), and pay particular attention to the first activity displayed in your application in your manifest files.






                                                                                                          share|improve this answer



















                                                                                                          • 3





                                                                                                            I would be interested if you could upload a project that demonstrates this phenomenon.

                                                                                                            – CommonsWare
                                                                                                            Apr 28 '15 at 20:07
















                                                                                                          3














                                                                                                          You can also get this error message on its own, without any stack trace or any further error message.



                                                                                                          In this case you need to make sure your Android manifest is configured correctly (including any manifest merging happening from a library and any activity that would come from a library), and pay particular attention to the first activity displayed in your application in your manifest files.






                                                                                                          share|improve this answer



















                                                                                                          • 3





                                                                                                            I would be interested if you could upload a project that demonstrates this phenomenon.

                                                                                                            – CommonsWare
                                                                                                            Apr 28 '15 at 20:07














                                                                                                          3












                                                                                                          3








                                                                                                          3







                                                                                                          You can also get this error message on its own, without any stack trace or any further error message.



                                                                                                          In this case you need to make sure your Android manifest is configured correctly (including any manifest merging happening from a library and any activity that would come from a library), and pay particular attention to the first activity displayed in your application in your manifest files.






                                                                                                          share|improve this answer













                                                                                                          You can also get this error message on its own, without any stack trace or any further error message.



                                                                                                          In this case you need to make sure your Android manifest is configured correctly (including any manifest merging happening from a library and any activity that would come from a library), and pay particular attention to the first activity displayed in your application in your manifest files.







                                                                                                          share|improve this answer












                                                                                                          share|improve this answer



                                                                                                          share|improve this answer










                                                                                                          answered Mar 22 '15 at 8:50









                                                                                                          PelpotronicPelpotronic

                                                                                                          46249




                                                                                                          46249








                                                                                                          • 3





                                                                                                            I would be interested if you could upload a project that demonstrates this phenomenon.

                                                                                                            – CommonsWare
                                                                                                            Apr 28 '15 at 20:07














                                                                                                          • 3





                                                                                                            I would be interested if you could upload a project that demonstrates this phenomenon.

                                                                                                            – CommonsWare
                                                                                                            Apr 28 '15 at 20:07








                                                                                                          3




                                                                                                          3





                                                                                                          I would be interested if you could upload a project that demonstrates this phenomenon.

                                                                                                          – CommonsWare
                                                                                                          Apr 28 '15 at 20:07





                                                                                                          I would be interested if you could upload a project that demonstrates this phenomenon.

                                                                                                          – CommonsWare
                                                                                                          Apr 28 '15 at 20:07











                                                                                                          2














                                                                                                          Crash during development



                                                                                                          Try logview-0.20 to get the logs and analyze them during development.

                                                                                                          Make sure to mark ./logview and ./lib/logview.jar as executable when running in Linux.



                                                                                                          If you don't like it, there're a lot of alternative desktop log viewers for Android.



                                                                                                          Crash in the wild



                                                                                                          Integrate a real-time crash reporting tool such as Firebase Crashlytics in order to get stacktraces of unhandled exceptions which occurred on users' devices.



                                                                                                          Read How to Release a Buggy App (And Live to Tell the Tale) to know more about handling bugs in the field.






                                                                                                          share|improve this answer






























                                                                                                            2














                                                                                                            Crash during development



                                                                                                            Try logview-0.20 to get the logs and analyze them during development.

                                                                                                            Make sure to mark ./logview and ./lib/logview.jar as executable when running in Linux.



                                                                                                            If you don't like it, there're a lot of alternative desktop log viewers for Android.



                                                                                                            Crash in the wild



                                                                                                            Integrate a real-time crash reporting tool such as Firebase Crashlytics in order to get stacktraces of unhandled exceptions which occurred on users' devices.



                                                                                                            Read How to Release a Buggy App (And Live to Tell the Tale) to know more about handling bugs in the field.






                                                                                                            share|improve this answer




























                                                                                                              2












                                                                                                              2








                                                                                                              2







                                                                                                              Crash during development



                                                                                                              Try logview-0.20 to get the logs and analyze them during development.

                                                                                                              Make sure to mark ./logview and ./lib/logview.jar as executable when running in Linux.



                                                                                                              If you don't like it, there're a lot of alternative desktop log viewers for Android.



                                                                                                              Crash in the wild



                                                                                                              Integrate a real-time crash reporting tool such as Firebase Crashlytics in order to get stacktraces of unhandled exceptions which occurred on users' devices.



                                                                                                              Read How to Release a Buggy App (And Live to Tell the Tale) to know more about handling bugs in the field.






                                                                                                              share|improve this answer















                                                                                                              Crash during development



                                                                                                              Try logview-0.20 to get the logs and analyze them during development.

                                                                                                              Make sure to mark ./logview and ./lib/logview.jar as executable when running in Linux.



                                                                                                              If you don't like it, there're a lot of alternative desktop log viewers for Android.



                                                                                                              Crash in the wild



                                                                                                              Integrate a real-time crash reporting tool such as Firebase Crashlytics in order to get stacktraces of unhandled exceptions which occurred on users' devices.



                                                                                                              Read How to Release a Buggy App (And Live to Tell the Tale) to know more about handling bugs in the field.







                                                                                                              share|improve this answer














                                                                                                              share|improve this answer



                                                                                                              share|improve this answer








                                                                                                              edited Sep 11 '18 at 8:41

























                                                                                                              answered Sep 11 '18 at 8:35









                                                                                                              naXanaXa

                                                                                                              14k892137




                                                                                                              14k892137























                                                                                                                  1














                                                                                                                  People make mistakes, and so coding as well.



                                                                                                                  When ever any error happened, always check with the logcat with the text in red color however u can find out the real problem in blue color text with underline in those red color text.



                                                                                                                  Make sure if u create a new activity, always declare the activity in the AndroidManifest file.



                                                                                                                  If adding Permission, declare it in the AndroidMainifest file as well.






                                                                                                                  share|improve this answer






























                                                                                                                    1














                                                                                                                    People make mistakes, and so coding as well.



                                                                                                                    When ever any error happened, always check with the logcat with the text in red color however u can find out the real problem in blue color text with underline in those red color text.



                                                                                                                    Make sure if u create a new activity, always declare the activity in the AndroidManifest file.



                                                                                                                    If adding Permission, declare it in the AndroidMainifest file as well.






                                                                                                                    share|improve this answer




























                                                                                                                      1












                                                                                                                      1








                                                                                                                      1







                                                                                                                      People make mistakes, and so coding as well.



                                                                                                                      When ever any error happened, always check with the logcat with the text in red color however u can find out the real problem in blue color text with underline in those red color text.



                                                                                                                      Make sure if u create a new activity, always declare the activity in the AndroidManifest file.



                                                                                                                      If adding Permission, declare it in the AndroidMainifest file as well.






                                                                                                                      share|improve this answer















                                                                                                                      People make mistakes, and so coding as well.



                                                                                                                      When ever any error happened, always check with the logcat with the text in red color however u can find out the real problem in blue color text with underline in those red color text.



                                                                                                                      Make sure if u create a new activity, always declare the activity in the AndroidManifest file.



                                                                                                                      If adding Permission, declare it in the AndroidMainifest file as well.







                                                                                                                      share|improve this answer














                                                                                                                      share|improve this answer



                                                                                                                      share|improve this answer








                                                                                                                      edited May 20 '18 at 7:15

























                                                                                                                      answered May 19 '18 at 17:24









                                                                                                                      Kopi BryantKopi Bryant

                                                                                                                      525217




                                                                                                                      525217

















                                                                                                                          protected by CommonsWare May 12 '14 at 18:06



                                                                                                                          Thank you for your interest in this question.
                                                                                                                          Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                                                                                                                          Would you like to answer one of these unanswered questions instead?



                                                                                                                          這個網誌中的熱門文章

                                                                                                                          Tangent Lines Diagram Along Smooth Curve

                                                                                                                          Yusuf al-Mu'taman ibn Hud

                                                                                                                          Zucchini