开发者

Application stopped unexpectedly on launch - no compilation errors in Eclipse

My application for Android (API level 8+) is compiled without any error messages in Eclipse.

The console says:

[2011-08-04 16:10:50 - PROJECT_NAME] Android Launch!
[2011-08-04 16:10:50 - PROJECT_NAME] adb is running normally.
[2011-08-04 16:10:50 - PROJECT_NAME] Performing PACKAGE_NAME.MainActivity activity launch
[2011-08-04 16:10:52 - PROJECT_NAME] Uploading PROJECT_NAME.apk onto device '80A354043048365763'
[2011-08-04 16:10:52 - PROJECT_NAME] Installing PROJECT_NAME.apk...
[2011-08-04 16:10:55 - PROJECT_NAME] Success!
[2011-08-04 16:10:55 - PROJECT_NAME] Starting activity PACKAGE_NAME.MainActivity on device DEVICE_ID
[2011-08-04 16:10:56 - PROJECT_NAME] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=PACKAGE_NAME/.MainActivity }

This is what is always displayed there. The application is then started on my USB-connected Android device.

It used to work fine, until at some point in the developing process the following message appeared:.

Sorry! The application Messages (process PACKAGE_NAME) has stopped unexpectedly. Please try again. Force close.

In the background, there is the application window - but without any GUI elements: no buttons, no text. Just the application's title on the top.

I don't know why this message appears. I cannot test my application anymore. And - as I already said - there are no errors in Eclipse.

Logcat says the following:

08-04 16:35:27.666: INFO/ActivityManager(2365): Force stopping package PACKAGE_NAME uid=10077
08-04 16:35:27.676: INFO/ActivityManager(2365): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=PACKAGE_NAME/.MainActivity }
08-04 16:35:27.726: WARN/Flex(2448): getString FLEX_OPERATOR_CODE OPEN
08-04 16:35:27.766: INFO/ActivityManager(2365): Start proc PACKAGE_NAME for activity PACKAGE_NAME/.MainActivity: pid=4262 uid=10077 gids={3003}
08-04 16:35:27.916: WARN/ActivityThread(4262): Application PACKAGE_NAME is waiting for the debugger on port 8100...
08-04 16:35:27.926: INFO/System.out(4262): Sending WAIT chunk
08-04 16:35:28.016: WARN/Flex(2365): getString FLEX_COUNTRY_CODE COM
08-04 16:3开发者_C百科5:28.016: WARN/Flex(2365): getString FLEX_OPERATOR_CODE OPEN
08-04 16:35:28.016: WARN/Flex(2365): getString FLEX_COUNTRY_CODE COM
08-04 16:35:28.016: WARN/Flex(2365): getString FLEX_OPERATOR_CODE OPEN
08-04 16:35:28.016: DEBUG/StatusBarPolicy(2365): [BRIGHTHY] 0. mDataNetType: 2
08-04 16:35:28.016: DEBUG/StatusBarPolicy(2365): [BRIGHTHY] curNetwork=26203 curHPLMN=26203
08-04 16:35:28.126: INFO/System.out(4262): Debugger has connected
08-04 16:35:28.136: INFO/System.out(4262): waiting for debugger to settle...
08-04 16:35:28.336: INFO/System.out(4262): waiting for debugger to settle...
08-04 16:35:28.536: INFO/System.out(4262): waiting for debugger to settle...
08-04 16:35:28.736: INFO/System.out(4262): waiting for debugger to settle...
08-04 16:35:28.936: INFO/System.out(4262): waiting for debugger to settle...
08-04 16:35:29.141: INFO/System.out(4262): waiting for debugger to settle...
08-04 16:35:29.336: INFO/System.out(4262): waiting for debugger to settle...
08-04 16:35:29.539: INFO/System.out(4262): waiting for debugger to settle...
08-04 16:35:29.739: INFO/System.out(4262): waiting for debugger to settle...
08-04 16:35:29.945: INFO/System.out(4262): waiting for debugger to settle...
08-04 16:35:30.146: INFO/System.out(4262): debugger has settled (1340)
08-04 16:35:31.016: WARN/Flex(2365): getString FLEX_COUNTRY_CODE COM
08-04 16:35:31.016: WARN/Flex(2365): getString FLEX_OPERATOR_CODE OPEN
08-04 16:35:31.016: WARN/Flex(2365): getString FLEX_COUNTRY_CODE COM
08-04 16:35:31.016: WARN/Flex(2365): getString FLEX_OPERATOR_CODE OPEN
08-04 16:35:31.026: DEBUG/StatusBarPolicy(2365): [BRIGHTHY] 0. mDataNetType: 2
08-04 16:35:31.026: DEBUG/StatusBarPolicy(2365): [BRIGHTHY] curNetwork=26203 curHPLMN=26203
08-04 16:35:34.016: WARN/Flex(2365): getString FLEX_COUNTRY_CODE COM
08-04 16:35:34.016: WARN/Flex(2365): getString FLEX_OPERATOR_CODE OPEN
08-04 16:35:34.016: WARN/Flex(2365): getString FLEX_COUNTRY_CODE COM
08-04 16:35:34.016: WARN/Flex(2365): getString FLEX_OPERATOR_CODE OPEN
08-04 16:35:34.026: DEBUG/StatusBarPolicy(2365): [BRIGHTHY] 0. mDataNetType: 2
08-04 16:35:34.026: DEBUG/StatusBarPolicy(2365): [BRIGHTHY] curNetwork=26203 curHPLMN=26203
08-04 16:35:37.016: WARN/Flex(2365): getString FLEX_COUNTRY_CODE COM
08-04 16:35:37.016: WARN/Flex(2365): getString FLEX_OPERATOR_CODE OPEN
08-04 16:35:37.016: WARN/Flex(2365): getString FLEX_COUNTRY_CODE COM
08-04 16:35:37.016: WARN/Flex(2365): getString FLEX_OPERATOR_CODE OPEN
08-04 16:35:37.026: DEBUG/StatusBarPolicy(2365): [BRIGHTHY] 0. mDataNetType: 2
08-04 16:35:37.026: DEBUG/StatusBarPolicy(2365): [BRIGHTHY] curNetwork=26203 curHPLMN=26203
08-04 16:35:37.697: WARN/ActivityManager(2365): Launch timeout has expired, giving up wake lock!
08-04 16:35:37.894: WARN/ActivityManager(2365): Activity idle timeout for HistoryRecord{451e5930 PACKAGE_NAME/.MainActivity}
08-04 16:35:40.016: WARN/Flex(2365): getString FLEX_COUNTRY_CODE COM
08-04 16:35:40.016: WARN/Flex(2365): getString FLEX_OPERATOR_CODE OPEN
08-04 16:35:40.016: WARN/Flex(2365): getString FLEX_COUNTRY_CODE COM
08-04 16:35:40.016: WARN/Flex(2365): getString FLEX_OPERATOR_CODE OPEN
08-04 16:35:40.026: DEBUG/StatusBarPolicy(2365): [BRIGHTHY] 0. mDataNetType: 2
08-04 16:35:40.026: DEBUG/StatusBarPolicy(2365): [BRIGHTHY] curNetwork=26203 curHPLMN=26203
08-04 16:35:43.017: WARN/Flex(2365): getString FLEX_COUNTRY_CODE COM
08-04 16:35:43.017: WARN/Flex(2365): getString FLEX_OPERATOR_CODE OPEN
08-04 16:35:43.017: WARN/Flex(2365): getString FLEX_COUNTRY_CODE COM
08-04 16:35:43.017: WARN/Flex(2365): getString FLEX_OPERATOR_CODE OPEN
08-04 16:35:43.026: DEBUG/StatusBarPolicy(2365): [BRIGHTHY] 0. mDataNetType: 2
08-04 16:35:43.026: DEBUG/StatusBarPolicy(2365): [BRIGHTHY] curNetwork=26203 curHPLMN=26203

I hope somebody can help me ... :) I'm almost desperate. Thank you very much in advance!

Edit #1:

When I run the application in Eclipse's debug mode, the error message doesn't appear. The application window appears but without any GUI elements. And I have to close the window using the HOME button. The BACK button doesn't work. And in the application settings I can choose "Force Stop". So is there any problem with threads maybe? Maybe the application got stuck?

Edit #2:

It doesn't seem to be an Eclipse problem or phone problem as I am still able to create a "Hello World" app. It even runs on the phone.

Edit #3:

My main activity starts as follows:

public class MainActivity extends ListActivity {

When I change this to ...

public class MainActivity extends Activity {

... and comment out the following line, the application is shown without any error messages:

setListAdapter(this.m_adapter);

Edit #4:

I think I can remember again what I changed before the problem occurred for the first time: I implemented the code of a tutorial on ListViews which worked fine. But then I changed the ID of the listview (see tutorial: main.xml) from "android:list" to "resultList". So this was probably the cause.

When I change it back now, the error occurrs in initiateSearch() where it says thread.notifyAll();

When I comment out this line, everything works without any errors, but the application does not what it should do anymore, of course.


Having talked to Marco it turns out the error was to do with the id naming of the List element in the xml.

http://developer.android.com/reference/android/app/ListActivity.html - "...To do this, your own view MUST contain a ListView object with the id '@android:id/list' ..."


Eclipse is a bit rubbish sometimes!!

Things I would try in order:

  1. Clean projects
  2. Restart Eclipse
  3. Completely remove the application and data & cache from your handset
  4. On your phone go in to your settings-> Applications-> Development and disable then re-enable USB Debugging
  5. Restart your phone
  6. Rebuild your eclipse workspace

Let me know if any of those help

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜