OSDN Git Service

Change how to find adb.
authorBill Napier <napier@google.com>
Mon, 22 Aug 2011 17:21:52 +0000 (10:21 -0700)
committerBill Napier <napier@google.com>
Mon, 22 Aug 2011 17:21:52 +0000 (10:21 -0700)
This method is aligned with how hierarchyviewer2 finds adb.

Change-Id: I56a5a12e3e6ff592748a3afee18299d16066a537

chimpchat/src/com/android/chimpchat/adb/AdbBackend.java

index 9354737..68e17dc 100644 (file)
@@ -17,10 +17,10 @@ package com.android.chimpchat.adb;
 
 import com.google.common.collect.Lists;
 
-import com.android.ddmlib.AndroidDebugBridge;
-import com.android.ddmlib.IDevice;
 import com.android.chimpchat.core.IChimpBackend;
 import com.android.chimpchat.core.IChimpDevice;
+import com.android.ddmlib.AndroidDebugBridge;
+import com.android.ddmlib.IDevice;
 import com.android.sdklib.SdkConstants;
 
 import java.io.File;
@@ -56,9 +56,9 @@ public class AdbBackend implements IChimpBackend {
     }
 
     private String findAdb() {
-        File location =
-            new File(AdbBackend.class.getProtectionDomain().getCodeSource().getLocation().getPath());
-        String mrParentLocation = new File(location.getParent()).getParent();
+        String mrParentLocation =
+            System.getProperty("com.android.monkeyrunner.bindir"); //$NON-NLS-1$
+
 
         // in the new SDK, adb is in the platform-tools, but when run from the command line
         // in the Android source tree, then adb is next to monkeyrunner.
@@ -70,8 +70,7 @@ public class AdbBackend implements IChimpBackend {
                 return platformTools.getAbsolutePath() + File.separator + SdkConstants.FN_ADB;
             }
 
-            return mrParentLocation + File.separator + SdkConstants.FD_OUTPUT +
-                    File.separator + SdkConstants.FN_ADB;
+            return mrParentLocation + File.separator + SdkConstants.FN_ADB;
         }
 
         return SdkConstants.FN_ADB;