when I run hierarchy in terminal. it can show the interface of it, but can not connect to my device.And it can connect to virtual emulator. It remind me in terminal like tha
Romain's ViewServer project (see answer #1) works great for this. I downloaded the code, turned the project into a library project, added a dependency in my app to the new library project, and changed my app's base Activity class to subclass from this simple class:
public class SimpleViewServerActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ViewServer.get(this).addWindow(this);
}
@Override
protected void onDestroy() {
super.onDestroy();
ViewServer.get(this).removeWindow(this);
}
@Override
protected void onResume() {
super.onResume();
ViewServer.get(this).setFocusedWindow(this);
}
}
Now I can connect from the Android Debug Monitor's Hierarchy View and debug my layout.