How to use the appium-android-driver.androidHelpers.createADB function in appium-android-driver

To help you get started, we’ve selected a few appium-android-driver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github appium / appium-uiautomator2-server / gulpfile.js View on Github external
gulp.task('sign-apk', async function signApks () {
  // Signs the APK with the default Appium Certificate
  const adb = await androidHelpers.createADB({});
  const pathToApk = path.resolve('apks', `appium-uiautomator2-server-v${version}.apk`);
  return adb.sign(pathToApk);
});
github appium / appium-uiautomator2-driver / lib / driver.js View on Github external
async startUiAutomator2Session () {
    // get device udid for this session
    let {udid, emPort} = await helpers.getDeviceInfoFromCaps(this.opts);
    this.opts.udid = udid;
    this.opts.emPort = emPort;

    // now that we know our java version and device info, we can create our
    // ADB instance
    this.adb = await androidHelpers.createADB(this.opts);

    const apiLevel = await this.adb.getApiLevel();

    if (apiLevel < 21) {
      logger.errorAndThrow('UIAutomator2 is only supported since Android 5.0 (Lollipop). ' +
        'You could still use other supported backends in order to automate older Android versions.');
    }

    if (apiLevel >= 28) { // Android P
      logger.warn('Relaxing hidden api policy');
      await this.adb.setHiddenApiPolicy('1');
    }

    // check if we have to enable/disable gps before running the application
    if (util.hasValue(this.opts.gpsEnabled)) {
      if (this.isEmulator()) {
github appium / appium-uiautomator2-server / lib / scripts / sign-apk.js View on Github external
async function main () {
  // Signs the APK with the default Appium Certificate
  const adb = await androidHelpers.createADB({});
  const pathToApk = path.resolve('apks', `appium-uiautomator2-server-v${packageJson.version}.apk`);
  await adb.sign(pathToApk);
}