• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

problem running HelloWorld app in Eclipse

asookazian

Lurker
Aug 7, 2011
1
0
Hello, World | Android Developers

Eclipse 3.7
SDK 3.2, 3.0, 2.3.3
Hierarchy Viewer version: 12.0.0.v201106281929-138431
Android Development Toolkit version: 12.0.0.v201106281929-138431

I tried running the helloworld app on all three target build platforms with a AVD selected for each one appropriately.

I am getting this error consistently:

Code:
[2011-08-07 21:55:04 - hierarchyviewer]Unable to get view server version from device emulator-5554
[2011-08-07 21:55:44 - hierarchyviewer]Unable to get view server protocol version from device emulator-5554

It also runs very slowly (in excess of 60 secs on Ubuntu 11.04).

I found the code that throws these exceptions in the com.android.hierarchyviewerlib.device.DeviceBridge class.

Here is the method involved:

Code:
public static ViewServerInfo loadViewServerInfo(IDevice device) {
        int server = -1;
        int protocol = -1;
        DeviceConnection connection = null;
        try {
            connection = new DeviceConnection(device);
            connection.sendCommand("SERVER"); //$NON-NLS-1$
            String line = connection.getInputStream().readLine();
            if (line != null) {
                server = Integer.parseInt(line);
            }
        } catch (Exception e) {
            Log.e(TAG, "Unable to get view server version from device " + device);
        } finally {
            if (connection != null) {
                connection.close();
            }
        }
        connection = null;
        try {
            connection = new DeviceConnection(device);
            connection.sendCommand("PROTOCOL"); //$NON-NLS-1$
            String line = connection.getInputStream().readLine();
            if (line != null) {
                protocol = Integer.parseInt(line);
            }
        } catch (Exception e) {
            Log.e(TAG, "Unable to get view server protocol version from device " + device);
        } finally {
            if (connection != null) {
                connection.close();
            }
        }
        if (server == -1 || protocol == -1) {
            return null;
        }
        ViewServerInfo returnValue = new ViewServerInfo(server, protocol);
        synchronized (sViewServerInfo) {
            sViewServerInfo.put(device, returnValue);
        }
        return returnValue;
    }

Any idea why this is happening and how I can fix this? thx.
 
I had the same problem until I looked at the tutorial code and realized that I had left the line:

super.onCreate(savedInstanceState);
setContentView(R.layout.main);

in my code instead of replacing it with the tutorial code:

super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello, Android");
setContentView(tv);
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones