我的問題是類似Android starting application after searching for it的Android應用程序崩潰調用getSystemService(LOCATION_SERVICE)時
我打電話
locationHelper.setLocationManager(this); // pass the appcontext to my helper method
從我的主要活動的onCreate()
。 我LocationHelper類看起來是這樣的:
public class LocationHelper {
private LocationManager locationManager;
[...]
public void setLocationManager(Context context){
locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
}
[...]
}
當我離開setLocationManager()
叫喚,應用程序運行正常,如果沒有它崩潰和下面的堆棧葉子:
Thread [<1> main] (Suspended (exception RuntimeException))
ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 1647
ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 1663
ActivityThread.access$1500(ActivityThread, ActivityThread$ActivityClientRecord, Intent) line: 117
ActivityThread$H.handleMessage(Message) line: 931
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 123
ActivityThread.main(String[]) line: 3683
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 507
ZygoteInit$MethodAndArgsCaller.run() line: 839
ZygoteInit.main(String[]) line: 597
NativeStart.main(String[]) line: not available [native method]
有人能幫助我解釋這些消息,因爲我沒有在調試android應用程序的任何地方找到任何文檔。
日Thnx的清理,火狐4B12沒有顯示編輯器的所有選項... – Julian 2011-03-06 21:50:35
Kesssel:這不是一個堆棧跟蹤。或者,更準確地說,這是Eclipse對錯誤堆棧跟蹤的再現。運行過去的異常點並使用DDMS透視圖檢查LogCat以查找真正的異常。 – CommonsWare 2011-03-06 23:02:54
我的問題是,因爲我的調用在'onCreate()'中,程序在開始時崩潰了。因此我無法激活堆檢查器或線程查看器。 – Julian 2011-03-07 17:16:25