Reputation: 28081
I modified my main.xml and my android app crashed.
I run debugger and find it threw a RuntimeException in
ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2663
I can't understand where the bug is in my program. I bisected the code, and find this line threw it:
giveUpButton = (Button) findViewById(R.id.GiveUpButton);
I'm sure because the exception disappeared after I removed this line.
I have no any idea. Why isn't the top of stack findViewById
? Why does it throw exception?
I have this code in main.xml:
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/give_up_button"
android:id="@+id/GiveUpButton"/>
Upvotes: 1
Views: 1101
Reputation: 116
did you
setContentView(R.layout.main)
before the line
giveUpButton = (Button)findViewById(R.id.GiveUpButton);
Upvotes: 0
Reputation: 28081
I know it sounds like a joke. But I have fixed the problem by... restarting my Eclipse.
It's very likely caused by Git's checkout. I switch between branches without closing Eclipse.
How can I avoid such a problem? It cost a lot of time to restart Eclipse over and over again.
Upvotes: 3