Problem with thread "main" ??

Put your problem here if it does not fit any of the other categories.

Problem with thread "main" ??

Postby iceking » Sat Jan 26, 2008 3:34 pm

I'm try to write a one to one chat program. I have a client on Abdroid and server on my computer.

I finish the client that it can get message from server and show on the text.

When I run my progarm, I have the following words showed on my Eclipse.

Can't find the main
java.lang.NoClassDefFoundError: com/google/android/Client
Exception in thread "main"
Attachments
Client.rar
My code
(1.6 KiB) Downloaded 113 times
iceking
Freshman
Freshman
 
Posts: 8
Joined: Wed Jan 23, 2008 6:47 pm
Location: Taiwan

Top

Postby plusminus » Sat Jan 26, 2008 3:53 pm

Hello iceking,

just had a really short look at your code and found that you call setUpEventListener(); before setting the actual ContentView. This is not possible, because within setUpEventListener(); you call findViewById(...); what relies on a previous call to setContentView(...).
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.         setUpEventListener();
  2.         setContentView(R.layout.main);
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


Can you debug your code, or is the Exception thrown before any line can be debugged :?:

Regards,
plusminus
Last edited by plusminus on Sat Jan 26, 2008 6:58 pm, edited 1 time in total.
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby iceking » Sat Jan 26, 2008 5:28 pm

I change the order of

setContentView(R.layout.main);
setUpEventListener();


I debug all lines of my code.

However, I have the same problem.

When I try to run the program, there is a Exception throw says can'tfind the main class,
iceking
Freshman
Freshman
 
Posts: 8
Joined: Wed Jan 23, 2008 6:47 pm
Location: Taiwan

Postby Ishtar » Sat Jan 26, 2008 5:39 pm

Are you sure it's android project? Do you debug it as an android project? Looks like its trying to launch it as a java program.

Ishtar
Ishtar
Experienced Developer
Experienced Developer
 
Posts: 50
Joined: Wed Jan 16, 2008 10:22 pm
Location: Netherlands

Postby iceking » Sat Jan 26, 2008 9:09 pm

Ishtar wrote:Are you sure it's android project? Do you debug it as an android project? Looks like its trying to launch it as a java program.

Ishtar



Sorry, at first I debug it as a java program.

However, I debug it as a android project. It has a problem.

I put the problem picture on the attachment.

Please try to help me, Thanks.
Attachments
question picture.png
Problem frame of my code
question picture.png (139.7 KiB) Viewed 775 times
iceking
Freshman
Freshman
 
Posts: 8
Joined: Wed Jan 23, 2008 6:47 pm
Location: Taiwan

Postby Ishtar » Sat Jan 26, 2008 9:23 pm

Thats 1 problem solved :)
Now, get Logcat, so you can see the exact error.

some thread here

At the bottom theres a screenshot that shows Logcat. Use it to track down your exception. You can also search for using Logcat. When you got the exact exception, we can help you further. I don't got time to debug your program...

Ishtar
Ishtar
Experienced Developer
Experienced Developer
 
Posts: 50
Joined: Wed Jan 16, 2008 10:22 pm
Location: Netherlands

Top

Postby iceking » Sun Jan 27, 2008 7:17 pm

Thanks for help.

I'm trying to use Logcat to slove my problem.
iceking
Freshman
Freshman
 
Posts: 8
Joined: Wed Jan 23, 2008 6:47 pm
Location: Taiwan

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 18 guests