1. Introducing Channels - a new way to chat with other Android users!
    Dismiss Notice

problem running HelloWorld app in Eclipse


Last Updated:

  1. asookazian

    asookazian New Member This Topic's Starter

    Joined:
    Aug 7, 2011
    Messages:
    1
    Likes Received:
    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 (Text):
    1. [2011-08-07 21:55:04 - hierarchyviewer]Unable to get view server version from device emulator-5554
    2. [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 (Text):
    1. public static ViewServerInfo loadViewServerInfo(IDevice device) {
    2.         int server = -1;
    3.         int protocol = -1;
    4.         DeviceConnection connection = null;
    5.         try {
    6.             connection = new DeviceConnection(device);
    7.             connection.sendCommand("SERVER"); //$NON-NLS-1$
    8.             String line = connection.getInputStream().readLine();
    9.             if (line != null) {
    10.                 server = Integer.parseInt(line);
    11.             }
    12.         } catch (Exception e) {
    13.             Log.e(TAG, "Unable to get view server version from device " + device);
    14.         } finally {
    15.             if (connection != null) {
    16.                 connection.close();
    17.             }
    18.         }
    19.         connection = null;
    20.         try {
    21.             connection = new DeviceConnection(device);
    22.             connection.sendCommand("PROTOCOL"); //$NON-NLS-1$
    23.             String line = connection.getInputStream().readLine();
    24.             if (line != null) {
    25.                 protocol = Integer.parseInt(line);
    26.             }
    27.         } catch (Exception e) {
    28.             Log.e(TAG, "Unable to get view server protocol version from device " + device);
    29.         } finally {
    30.             if (connection != null) {
    31.                 connection.close();
    32.             }
    33.         }
    34.         if (server == -1 || protocol == -1) {
    35.             return null;
    36.         }
    37.         ViewServerInfo returnValue = new ViewServerInfo(server, protocol);
    38.         synchronized (sViewServerInfo) {
    39.             sViewServerInfo.put(device, returnValue);
    40.         }
    41.         return returnValue;
    42.     }
    Any idea why this is happening and how I can fix this? thx.
     

    Advertisement
  2. xDroidApps

    xDroidApps Member

    Joined:
    Oct 11, 2011
    Messages:
    6
    Likes Received:
    0
    are you running the same program more than once with no changes?

    and if you shut down the emulator and then run the app does it work fine?

    I had a similar error
     
  3. theArchitect65

    theArchitect65 New Member

    Joined:
    Feb 18, 2012
    Messages:
    1
    Likes Received:
    0
    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);
     

Share This Page

Loading...