The application has stopped unexpected. Please try again

Source: Internet
Author: User

1. After running the program, the application *** has stopped is displayed.

Unexpectedly. Please try again. Then pray to force exit.
This is a classic error. The socket cannot be connected externally. The specific error will not be

Reporting, debugging, but exception can be seen, as long as there is a network connection,

So that your program cannot run.

The reason is: you need to access the network, so in androidmanifest. xml

, The following configuration is required:
In permission on the third page below, select "add..." and select "uses

Permission, select

"Android. Permission. Internet ";

The following statement is displayed in androidmanifest. xml:

Android: Name = "android. Permission. Internet"/>
Run the program again.

2. The *** has not responding error is displayed ":
There are several reasons: the server is not opened,
The IP address to connect to the client is incorrect,
The ports of the server and client are inconsistent.

Receiving and sending of clients and servers

There is no one-to-one correspondence,
This causes the wait to time out and an exception occurs.
But is my problem still solved?

3. When learning Android, you may encounter exceptions occasionally. For example, if an exception occurs: "The application has stopped unexpectedly", first check whether your code has a logical error or a vulnerability, for example, whether a null object is used. Whether the object has been instantiated before use. In addition, special attention should be paid to Android. The whole program should be concerned with three parts:
Business logic: whether the logic is reasonable and the code is correct. You can view log records through debugging and running.
Resource application-android resources are placed under the res file. For example, the layout of an activity is generally placed under the Res/layout file, and an XML file corresponds to an activity.
Androidmanifest. xml -- previously I ignored this very important thing when I was learning another example, which led to the occurrence of the application has stopped unexpectedly.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.