Error 1: The application has stopped unexpectedly
Explanation: The application stops unexpectedly.
Solution: 1) first check Java file logic problems, such as force type conversion error
Privateimagebutton button;
Button = (button) findviewbyid (R. Id. Button );
There are other types of errors, which are not provided here
2) my first response was the XML file configuration error.
Check the layout folderAnd values filesSee if there is a syntax error in the XML file.
Here is an invisible error that is hard to find.
Because the code is changed multiple times, the code is generated and the code is run. This causes file disorder in the project. An unrecognized error occurs when you add an XML file or add elements in the XML file again. Even if the syntax you write is correct.
Solution: Right-click the Agency and choose clean and generate
3) if multiple java files are written, I will pay attention to the modification of androidmanifest. xml.
<Activity Android: Name = "maintab">
</Activity>
<Activity Android: Name = "localmusic">
</Activity>
4) if the program requires networking, and androidmainfest. XML has no relevant configuration
You need to add: <uses-Permission Android: Name = "android. Permission. Internet"/>
2. Error 2: The function in the execution thread is always stopped for no reason
Solution: Use try () catch (exception) {} to include the statement to be executed to solve this type of error.