cannot connect to VM

11,118

Solution 1

You probably figured this out already, but for others who get stuck in this situation, here is my answer. I've had this problem a couple of times myself now, and I finally found out that it's related to

including a "main" method in your android class files: Don't do it!

Run Configuration in Eclipse: Delete the automatically created application configurations

The following link provides a very good explanation about the problem, the solution, and the reasons: http://independentlyemployed.co.uk/2010/11/16/solved-internal-error-classfileparser-cpp3161/

Solution 2

It caused by having a "main" method.
Delete/rename the method and then go to the properties of the project.
Click "Run/Debug Settings" and delete the class (it may make eclipse to run the class after being compiled).

Solution 3

I had to change the Test Launcher being used.

Run->Debug Configurations->JUnit->*JUnit Test Class*

Choose Select Other in the bottom left of the settings dialog, next to the menu list.

enter image description here

Share:
11,118
Kat
Author by

Kat

Updated on July 17, 2022

Comments

  • Kat
    Kat almost 2 years

    I made a test class in my android project to check if my database works. But when I want to debug this class it gives me an error: "Cannot connect to VM", in details it says also "Socket operation on nonsocket: configureBlocking". When I try debugging a test class in another project it works and debugging my other classes in the android project also works. Can the problem be that I try to run a normal test on an android project?

    Can someone help me? Thanks!

  • danny117
    danny117 about 10 years
    ecliplse run/run configurations... click the x to delete. I got a main method in my new class file automatically while adding a service class to the project and selecting the service super class. usually when I do this it adds the necessary stubs but this time yes it did add the main method.
  • danny117
    danny117 about 10 years
    click the red x to delete this configuration