当前位置: 首页>>代码示例>>Java>>正文


Java AndroidDebugBridge.init方法代码示例

本文整理汇总了Java中com.android.ddmlib.AndroidDebugBridge.init方法的典型用法代码示例。如果您正苦于以下问题:Java AndroidDebugBridge.init方法的具体用法?Java AndroidDebugBridge.init怎么用?Java AndroidDebugBridge.init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.android.ddmlib.AndroidDebugBridge的用法示例。


在下文中一共展示了AndroidDebugBridge.init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: connectToAndroidDevice

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
public void connectToAndroidDevice() {
	LoggerHelper.logEvent(MyLevel.RUNTIME, "Connecting to ADB...");				
	if(adb == null) {
	    AndroidDebugBridge.init(false);		    			
//		AndroidDebugBridge bridge = AndroidDebugBridge.createBridge(
//				FrameworkOptions.PLATFORM_TOOLS + File.separator + "adb", true);
		adb = AndroidDebugBridge.createBridge();				
	}
	
	waitForDevice();		
	this.device = getDevice(FrameworkOptions.devicePort);
	if(this.device == null) {
		LoggerHelper.logEvent(MyLevel.EXCEPTION_RUNTIME, String.format("Device with port %s not found! -- retry it", FrameworkOptions.devicePort));
		connectToAndroidDevice();
	}
	LoggerHelper.logEvent(MyLevel.RUNTIME, "Successfully connected to ADB...");		
}
 
开发者ID:srasthofer,项目名称:FuzzDroid,代码行数:18,代码来源:FrameworkEventManager.java

示例2: getADBInstance

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
/**
 * 获取ADB连接实例
 * 
 * @return AndroidDebugBridge
 */
public static AndroidDebugBridge getADBInstance() {
	if (bridge == null) {
		AndroidDebugBridge.init(false);
		String os = System.getProperty("os.name").toLowerCase();
		if (os.startsWith("win")) {
			// 如果是win系统
			bridge = AndroidDebugBridge.createBridge(DirConfig.ADB_DIR + "adb.exe", true);
		} else if(os.startsWith("mac")) {
			// 如果是osx系统
			bridge = AndroidDebugBridge.createBridge(DirConfig.MAC_ADB_DIR + "adb", true);
		} else {
			bridge = AndroidDebugBridge.createBridge("adb",true);
		}
	}
	return bridge;
}
 
开发者ID:GroupControlDroid,项目名称:GroupControlDroidClient,代码行数:22,代码来源:AdbUtil.java

示例3: initDebugBridge

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
private void initDebugBridge() {
	if (bridge == null) {
		AndroidDebugBridge.init(false);
	}
	
	if ((bridge == null) || (!bridge.isConnected())) {
		String adbLocation = System.getProperty("user.dir");
		System.out.println(adbLocation);
		if ((adbLocation != null) && (adbLocation.length() != 0)) {
			adbLocation = adbLocation + File.separator + "adb";
			File file= new File(adbLocation);
			if(!file.exists())
				adbLocation = "adb";
		}else{
			adbLocation = "adb";
		}
		bridge = AndroidDebugBridge.createBridge(adbLocation, false);
	}
}
 
开发者ID:hoozheng,项目名称:AndroidRobot,代码行数:20,代码来源:AdbDevice.java

示例4: main

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
/**
 * Runs main program.
 */
public static void main(String[] args) {
    try {
        Display display = new Display();
        FileViewer application = new FileViewer();
        Shell shell = application.open(display);
        AndroidDebugBridge.init(true);
        AndroidDebugBridge.createBridge("adb", true);
        AndroidDebugBridge.addDeviceChangeListener(application);
        application.showConnectDialog();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch())
                display.sleep();
        }
        application.close();
        display.dispose();
        System.exit(0);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:lrscp,项目名称:AndroidFileExplorer,代码行数:24,代码来源:FileViewer.java

示例5: connect

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
/**
 * 
 * @param adbFilePath
 * @param listener
 * @return
 */
public boolean connect(String adbFilePath, DeviceConnectionListener listener) {
    if (!checkPath(adbFilePath)) {
        Util.DbgLog("Error occured in setting adb binary file path");
        return false;
    }

    if (mIsAdbInitialized) {
        Util.DbgLog("Already connected..");
        return false;
    }

    mDeviceStateListener = listener;

    AndroidDebugBridge.init(false /* no need to support debug*/);
    AndroidDebugBridge.addClientChangeListener(mClientChangeListener);
    AndroidDebugBridge.addDeviceChangeListener(mDeviceChangeListener);
    AndroidDebugBridge.createBridge(adbFilePath, true /* forceNewBridge */);
    mIsAdbInitialized = true;
    return true;
}
 
开发者ID:felixb,项目名称:logcat-gui,代码行数:27,代码来源:AdbWrapper.java

示例6: init

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
public static void init() {
  String adbLocation = getAdbLocation();
  if (adbLocation != null) {
    AndroidDebugBridge.init(false /* debugger support */);
    sDebugBridge = AndroidDebugBridge.createBridge(adbLocation, false);
  }
}
 
开发者ID:DroidTesting,项目名称:android-uiautomatorviewer,代码行数:8,代码来源:DebugBridge.java

示例7: initAndroidDebugBridge

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
protected static AndroidDebugBridge initAndroidDebugBridge(AndroidBuilder androidBuilder) {
    synchronized (ADB_LOCK) {
        if (!adbInitialized) {
            DdmPreferences.setTimeOut(adbConnectionTimeout);
            AndroidDebugBridge.init(false);
            adbInitialized = true;
        }
        AndroidDebugBridge androidDebugBridge = AndroidDebugBridge.createBridge(
            androidBuilder.getSdkInfo().getAdb().getAbsolutePath(), false);
        waitUntilConnected(androidDebugBridge);
        return androidDebugBridge;
    }
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:14,代码来源:AwoInstaller.java

示例8: AdbBackend

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
public AdbBackend() {
    // [try to] ensure ADB is running
    String adbLocation = findAdb();

    AndroidDebugBridge.init(true/* debugger support */);

    bridge = AndroidDebugBridge.createBridge(
            adbLocation, true /* forceNewBridge */);
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:10,代码来源:AdbBackend.java

示例9: initDebugBridge

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
/**
 * Creates an {@link AndroidDebugBridge} connected to adb at the given location.
 *
 * If a bridge is already running, this disconnects it and creates a new one.
 *
 * @param adbLocation the location to adb.
 */
public static void initDebugBridge(String adbLocation) {
    if (sBridge == null) {
        AndroidDebugBridge.init(false /* debugger support */);
    }
    if (sBridge == null || !sBridge.isConnected()) {
        sBridge = AndroidDebugBridge.createBridge(adbLocation, true);
    }
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:16,代码来源:DeviceBridge.java

示例10: ServerConnectionManager

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
/**
 * 
 */
private ServerConnectionManager() {
	devices = new HashMap<String, AndroidDevice>();
	AndroidDebugBridge
			.addDeviceChangeListener(ServerConnectionManager.this);
	AndroidDebugBridge.init(false);
}
 
开发者ID:IPEldorado,项目名称:RemoteResources,代码行数:10,代码来源:ServerConnectionManager.java

示例11: initApp

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
void initApp() {
	UIManager.put("ScrollBar.width", new Integer(Config.SCROLLBAR_WIDTH));

	mMainFrame.initFrame();
	mMainFrame.addPanel();

	String adbPath = Utils.findAdb();
	AndroidDebugBridge.init(false /* debugger support */);
	mAdb = AndroidDebugBridge
			.createBridge(adbPath, false /* forceNewBridge */);
	
	mDeviceChannel = new DeviceMsgChannel();
	mDeviceChannel.start();
}
 
开发者ID:HoneyFish,项目名称:SmartTools,代码行数:15,代码来源:SmartToolsApp.java

示例12: createAdb

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
/**
 * Creates connection to adb and waits for this connection to be initialized
 * and receive initial list of devices.
 */
@Nullable
@SuppressWarnings("PMD.EmptyCatchBlock")
private AndroidDebugBridge createAdb(ExecutionContext context) throws InterruptedException {
  try {
    AndroidDebugBridge.init(/* clientSupport */ false);
  } catch (IllegalStateException ex) {
    // ADB was already initialized, we're fine, so just ignore.
  }

  AndroidDebugBridge adb = null;
  if (context != null) {
    adb = AndroidDebugBridge.createBridge(context.getPathToAdbExecutable(), false);
  } else {
    adb = AndroidDebugBridge.createBridge();
  }
  if (adb == null) {
    console.printBuildFailure("Failed to connect to adb. Make sure adb server is running.");
    return null;
  }

  long start = System.currentTimeMillis();
  while (!isAdbInitialized(adb)) {
    long timeLeft = start + ADB_CONNECT_TIMEOUT_MS - System.currentTimeMillis();
    if (timeLeft <= 0) {
      break;
    }
    Thread.sleep(ADB_CONNECT_TIME_STEP_MS);
  }
  return isAdbInitialized(adb) ? adb : null;
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:35,代码来源:AdbHelper.java

示例13: AdbBackend

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
public AdbBackend() {
    // [try to] ensure ADB is running
    String adbLocation = findAdb();

    AndroidDebugBridge.init(false /* debugger support */);

    bridge = AndroidDebugBridge.createBridge(
            adbLocation, true /* forceNewBridge */);
}
 
开发者ID:liuyq,项目名称:aster,代码行数:10,代码来源:AdbBackend.java

示例14: createAdb

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
/**
 * Creates connection to adb and waits for this connection to be initialized and receive initial
 * list of devices.
 */
@Nullable
@SuppressWarnings("PMD.EmptyCatchBlock")
private static AndroidDebugBridge createAdb(
    AndroidPlatformTarget androidPlatformTarget, ExecutionContext context)
    throws InterruptedException {
  DdmPreferences.setTimeOut(60000);

  try {
    AndroidDebugBridge.init(/* clientSupport */ false);
  } catch (IllegalStateException ex) {
    // ADB was already initialized, we're fine, so just ignore.
  }

  AndroidDebugBridge adb =
      AndroidDebugBridge.createBridge(androidPlatformTarget.getAdbExecutable().toString(), false);
  if (adb == null) {
    context
        .getConsole()
        .printBuildFailure("Failed to connect to adb. Make sure adb server is running.");
    return null;
  }

  long start = System.currentTimeMillis();
  while (!isAdbInitialized(adb)) {
    long timeLeft = start + ADB_CONNECT_TIMEOUT_MS - System.currentTimeMillis();
    if (timeLeft <= 0) {
      break;
    }
    Thread.sleep(ADB_CONNECT_TIME_STEP_MS);
  }
  return isAdbInitialized(adb) ? adb : null;
}
 
开发者ID:facebook,项目名称:buck,代码行数:37,代码来源:AdbHelper.java

示例15: init

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
private void init() {
  if (bridge == null || !bridge.isConnected()) {
    AndroidDebugBridge.init(false);
    bridge = AndroidDebugBridge.createBridge();
  }
}
 
开发者ID:google,项目名称:ferret,代码行数:7,代码来源:DeviceEventReceiver.java


注:本文中的com.android.ddmlib.AndroidDebugBridge.init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。