Unfortunately MyApp has stopped. How can I solve it?

This article was translated from: Unfortunately MyApp has stopped. How can I solve this?

I am developing an application, and everytime I run it, I get the message: I am developing an application, and every time I run it, I receive the following message:

Unfortunately, MyApp has stopped. Unfortunately, MyApp has stopped.

What can I do to solve this ?


Question the this the About - obviously Inspired by the What IS A Stack the trace, and How the I CAN use IT to My Debug the Application errors? On this issue - obviously subject to what is the stack trace of inspiration , and how to use it to debug application error? , there are lots of questions stating that their application has crashed, without any further detail. , there are many questions indicating that their application has crashed without any further details. This question aims to instruct novice Android programmers on how to try and fix their problems themselves, or ask the right questions. The purpose of this question is to guide novice Android programmers how to solve the problem by themselves or ask the right question .


#1st Floor

Reference: https://stackoom.com/question/1ZzE5/ Unfortunately MyApp has stopped-how can I solve it


#2nd Floor

This answer describes the process of retrieving the stack trace. This answer describes the process of retrieving the stack trace . Already have the stack trace? Is there already a stack trace? ON Stack traces up in the Read " the What IS A Stack the trace, and How the I CAN use IT to My Debug the Application errors? " In the " What is the stack trace, and how to use it to debug application error? " Reading the stack trace.

The Problem problem

Your application quit because an uncaught RuntimeExceptionwas thrown. Your application quit because it caused RuntimeException an uncaught .
THESE IS MOST of the Common at The at The NullPointerException. One of the most common NullPointerException.

How to solve it? How to solve it ?

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

Android Studio Android Studio

Find stack trace in Android Studio

The The bottom bar of the In window, the Click ON The LogcatButton. At the bottom bar of the window, click Logcatthe button. Alternatively, you can press alt+ 6. Or, you can press alt+ 6. The Sure your Device Emulator or the Make IS in the Selected at The DevicesPanel. Ensure that " DevicesSelect the emulator or device panel. The Next, the try to the Find at The Stack the trace, Which IS Shown in Red. Next, try to find the stack trace shown in red There may be a lot of stuff logged into logcat, so you may need to scroll a bit . There may be a lot of things logged into logcat, so you may need to scroll . 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. An easy way to find the stack trace is to clear the logcat (using the recycle bin on the right) and then crash the app again .

I have found the stack trace, now what? I have found the stack trace, now what ?

Yay! Excellent ! You're halfway to solving your problem. You're halfway to solving your problem .
You only need to find out what exactly made your application crash, by analyzing the stack trace. You only need to analyze the stack trace to find out what caused the application to crash.

ON Stack traces up in the Read " the What IS A Stack the trace, and How the I CAN use IT to My Debug the Application errors? " In the " What is the stack trace, and how to use it to debug application error? " Reading the stack trace.

I still can't solve my problem! I still can't solve my problem !

If you've found your Exceptionand the line where it occurred, and still cannot figure out how to fix it, don't hesitate to ask a question on StackOverflow. If you find the Exceptionline and its occurrence, but still can't think of a solution Method, please feel free to ask questions on StackOverflow.

Try to be as concise as possible: post the stack trace, and the relevant code (eg a few lines up to the line which threw the Exception). Be as concise as possible: post the stack trace and related code (for example, Exceptionadd before throwing the line A few lines).


#3rd floor

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

After that, you find which point your app has stopped it's very easy to solve at your side. After that, you will find where your application stopped, which is easy to solve by your side .


#4th floor

You can also get this error message on its own, without any stack trace or any further error message. You can also get this error message separately without any stack trace or any other 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 . in this case, you need to ensure proper configuration of the Android list (including a list of all occurred in the library merger and any activities that occur in the library), and pay special attention to the list of files displayed in the first active application.


#5th Floor

CAN use by You Google's ADB Tool to GET Logcat fileto the Analyze at The Issue. You can use Google's ADB tool acquired Logcat fileto analyze the problem.

adb logcat > logcat.txt

Open logcat.txtFile and the Application Search for your name. Open the logcat.txtfile and search for your application name. There should be information on why it failed, the line number, Class name, etc. There should be information about the reason for failure, line number, class name, etc.


#6th floor

Just check the error in log cat. Just check the error in log cat .

You get the log cat option from in eclipse: You can get the log cat option from Eclipse:

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

Log cat contains error. Log cat contains error.

Other wise you can also check the error by executing an application in debug mode. Otherwise, you can also check the error by executing the application in debug mode . Firstly set breakpoint after that by doing: First set a breakpoint through the following operations:

right click on project-> debug as-> Android application , right-click the project - commissioning> -> Android Applications

Published 0 original articles · praised 8 · 30,000+ views

Guess you like

Origin blog.csdn.net/asdfgh0077/article/details/105434032
Recommended