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

run-android doesn't start app on device when ANDROID_HOME not set #375

Closed
nnnnnoel opened this issue May 7, 2019 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@nnnnnoel
Copy link

nnnnnoel commented May 7, 2019

Environment

React Native Environment Info:
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Pentium(R) CPU G4600 @ 3.60GHz
Memory: 2.37 GB / 7.89 GB
Binaries:
Yarn: 1.15.2 - C:\Users\Shinpei\AppData\Roaming\npm\yarn.CMD
npm: 6.7.0 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.4.0.0 AI-183.5429.30.34.5452501

Description

it doesnt start app when we dont have ANDROID_HOME in $PATH and finished react-native run-android.

Reproducible Demo

'use strict';

Object.defineProperty(exports, '__esModule', {
  value: true,
});
// eslint-disable-next-line no-void
exports.default = void 0;

/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
@@ -6,11 +14,34 @@
 *
 * @flow
 */
function getOS() {
  var platform = window.navigator.platform,
    macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'],
    windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'],
    os = null;

  if (macosPlatforms.indexOf(platform) !== -1) {
    os = 'Mac OS';
  } else if (windowsPlatforms.indexOf(platform) !== -1) {
    os = 'Windows';
  } else if (!os && /Linux/.test(platform)) {
    os = 'Linux';
  }

  return os;
}

function getAdbPath() {
  return process.env.ANDROID_HOME
    ? `${process.env.ANDROID_HOME}/platform-tools/adb`
    : getOS() === 'Windows'
    ? `C:/Users/${
        require('os').userInfo().username
      }/AppData/Local/Android/Sdk/platform-tools/adb`
    : `/Users/${
        require('os').userInfo().username
      }/Library/Android/sdk/platform-tools/adb`;
}

var _default = getAdbPath;
exports.default = _default;
@nnnnnoel nnnnnoel added the bug Something isn't working label May 7, 2019
@thymikee
Copy link
Member

thymikee commented Jul 7, 2019

This will be checked by #51

@thymikee thymikee changed the title it doesn`t start app on device run-android doesn't start app on device when ANDROID_HOME not set Jul 8, 2019
@thymikee thymikee closed this as completed Jul 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants