Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

please using $ANDROID_HOME to make absolute path to call adb command #239

Open
baivoom opened this issue Aug 19, 2018 · 0 comments
Open

Comments

@baivoom
Copy link

baivoom commented Aug 19, 2018

Issue

npx weex run android
...

/bin/sh: 1: adb: not found

Reason and Solution

source: weexpack/lib/run/android.js
Using absolute path from $ANDROID_HOME instead of relative path to call 'adb' command.

var prepareAndroid = function prepareAndroid(_ref) {
  var options = _ref.options;

  return new Promise(function (resolve, reject) {
    var rootPath = process.cwd();

    logger.info('start Android app \n');

    // change working directory to android
    process.chdir(path.join(rootPath, 'platforms/android'));
    if (!process.env.ANDROID_HOME) {
      logger.error('Environment variable $ANDROID_HOME not found !');
      logger.log('You should set ANDROID_HOME in your environment first.');
      logger.log('See ' + chalk.cyan('https://spring.io/guides/gs/android/'));
      reject();
    }
    const adb = `${process.env.ANDROID_HOME}/platform-tools/adb`
    try {
      childprocess.execSync(`${adb} start-server`, {
        encoding: 'utf8'
      });
    } catch (e) {
      reject(new Error(`execute 'adb start-server' failed. ${e}`));
      return;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant