Summary of debugging the GMS Project

Source: Internet
Author: User
A small summary of the debugging of the GMS project:
1. When a program runs on a mobile phone, an exception occurs: When NULL pointer has no pointer, it is often because in the program, we access the member variables or member methods of an object, the value of this object is null.
2. The destroyappexception may be caused by an invalid operation in the destroyapp () method of the main program, such as fileselector. stop (), but if we have not constructed an object such as fileselector, this exception will occur.
3. The most important thing is that a warning window prompt is displayed at the beginning of running: MIDlet-name null, which is caused by the Startapp () of the main program () in the method, we define a warning window to display the manufacturer who made the MIDlet. When writing a program, the statement encountered an error, which should be: getappproperty ("MIDlet-vendor"), but I write it as system. getproperty ("MIDlet-vendor"), so the returned value is null, so the warning window prompts: MIDlet-name null.
4. Prompt to run in the background. The key is that the main interface is not displayed. This is also an error in programming. Set if (! In isapiavailable), remove the exclamation point and add fileselector to the setcurrent () to display the file browsing main interface, so that no error message is displayed in the background.
5. When the file is displayed, it may be empty. You only need to set currentroot = (fileconnection) (connector) in case init_op of the fileselector class. open (initdir, connector. read) This statement, remember to be connector. if read is written as connector. read_write may be empty.
6. There is an out-of-Memory exception. It is often because the picture is too large and the memory is loaded out of bounds. Sometimes other exceptions are absent, and this exception is gone, a little strange.
Summary: When debugging a program, it is best to add debugging functions slowly. Do not wait until all the program code is written and then install it on the mobile phone for debugging. In this case, when a problem occurs, it is difficult to analyze the cause of the error.

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: info-contact@alibabacloud.com 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.