NativeScript / NativeScript/nativescript-cli

The ANDROID_HOME environment variable is not set or it points to a non-existent directory. You will not be able to perform any build-related operations for Android.

Open
#5,710 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs more info
Dominant language
JavaScript
Stars
1.1k
Forks
204
Avg merge
1d 9h
Merged PRs (30d)
8

Description

Issue Description

sudo tns run android

✔ The Android SDK is installed.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✖ The ANDROID_HOME environment variable is not set or it points to a non-existent directory. You will not be able to perform any build-related operations for Android.
To be able to perform Android build-related operations, set the ANDROID_HOME variable to point to the root of your Android SDK installation directory.

✖ WARNING: adb from the Android SDK is not installed or is not configured properly.
For Android-related operations, the NativeScript CLI will use a built-in version of adb.
To avoid possible issues with the native Android emulator, Genymotion or connected
Android devices, verify that you have installed the latest Android SDK and
its dependencies as described in http://developer.android.com/sdk/index.html#Requirements

✖ Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 28 or later.
Run $ sdkmanager to manage your Android SDK versions.

✖ No compatible version of the Android SDK Build-tools are installed on your system. You can install any version in the following range: '>=23 <=33'.
Install the required build-tools through Android Studio. In case you already have them installed, make sure the ANDROID_HOME environment variable is set correctly.

Your environment is not configured properly and you will not be able to execute local builds.
Verify that your environment is configured according to the system requirements described at
https://docs.nativescript.org/environment-setup.html#macos-android.

Reproduction

sudo tns run android

Relevant log output (if applicable)
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*                                                                                                                                               *
*  The "TRACE" log level might print some sensitive data like secrets or access tokens in request URLs. Be careful when you share this output.  *
*                                                                                                                                               *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


Trying to get macOS version.
Exec system_profiler SPSoftwareDataType -detailLevel mini 
 stdout: Software:

    System Software Overview:

      System Version: macOS 10.15.7 (19H2026)
      Kernel Version: Darwin 19.6.0
      Time since boot: 1:56

 
 stderr: 
macOS version based on system_profiler is 10.15.
Looking for project in '/Users/alexandredomingues/Downloads/nativeScript/ns-ng-course'
Project directory is '/Users/alexandredomingues/Downloads/nativeScript/ns-ng-course'.
Initializing project identifiers. Config:  {
  id: 'org.nativescript.nsngcourse',
  appPath: 'src',
  appResourcesPath: 'App_Resources',
  android: { v8Flags: '--expose_gc', markingMode: 'none' }
}
Loading extensions.
Collecting system information...
System information:
{
  "platform": "darwin",
  "shell": "/bin/bash",
  "os": "Darwin Alexandres-Mac.lan 19.6.0 Darwin Kernel Version 19.6.0: Tue Jun 21 21:18:39 PDT 2022; root:xnu-6153.141.66~1/RELEASE_X86_64 x86_64\n",
  "procArch": "x64",
  "nodeVer": "16.17.0",
  "npmVer": "9.2.0",
  "nodeGypVer": null,
  "nativeScriptCliVersion": "8.4.0",
  "gitVer": "2.21.0",
  "dotNetVer": null,
  "javacVersion": "11.0.17",
  "javaVersion": "11.0.17",
  "javaPath": "java",
  "adbVer": "1.0.41",
  "androidInstalled": true,
  "monoVer": null,
  "gradleVer": null,
  "isAndroidSdkConfiguredCorrectly": true,
  "xcodeprojLocation": null,
  "itunesInstalled": true,
  "isCocoaPodsWorkingCorrectly": true,
  "isCocoaPodsUpdateRequired": false,
  "pythonInfo": {
    "isInstalled": true,
    "isSixPackageInstalled": true
  }
}
Current CLI version:  8.4.0
Project dir from hooksArgs is: undefined.
Hooks directories: [
  '/Users/alexandredomingues/Downloads/nativeScript/ns-ng-course/hooks'
]
BeforeHookName for command resolveCommand is before-resolveCommand
Project dir from hooksArgs is: undefined.
Hooks directories: [
  '/Users/alexandredomingues/Downloads/nativeScript/ns-ng-course/hooks'
]
AfterHookName for command resolveCommand is after-resolveCommand
Trying to handle SIGINT event. CLI overrides this behavior and does not allow handling SIGINT as this causes issues with Ctrl + C in terminal.
The stackTrace of the location trying to handle SIGINT is:
    at process.on (/usr/local/lib/node_modules/nativescript/lib/nativescript-cli.js:26:28)
    at /usr/local/lib/node_modules/nativescript/node_modules/signal-exit/index.js:158:17
    at Array.filter (<anonymous>)
    at load (/usr/local/lib/node_modules/nativescript/node_modules/signal-exit/index.js:156:23)
    at module.exports (/usr/local/lib/node_modules/nativescript/node_modules/signal-exit/index.js:62:7)
    at Object.<anonymous> (/usr/local/lib/node_modules/nativescript/node_modules/proper-lockfile/lib/lockfile.js:331:1)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
spawn: /usr/local/bin/node "/usr/local/lib/node_modules/nativescript/lib/detached-processes/cleanup-process.js" "/usr/local/lib/node_modules/nativescript/lib/bootstrap.js"
Initializing analytics statuses.
Analytics statuses:  { TrackFeatureUsage: 'enabled', TrackExceptions: 'enabled' }
Will send the following information to Google Analytics: {
  type: 'googleAnalyticsData',
  category: 'CLI',
  googleAnalyticsDataType: 'pageview',
  path: 'doctor',
  title: 'doctor',
  customDimensions: { cd5: 'CLI', cd2: 'Angular', cd9: 'false' }
}
spawn: /usr/local/bin/node "/usr/local/lib/node_modules/nativescript/lib/services/analytics/analytics-broker-process.js" "/usr/local/lib/node_modules/nativescript/lib/bootstrap.js"
Will send the following information to Google Analytics: {
  type: 'googleAnalyticsData',
  category: 'CLI',
  googleAnalyticsDataType: 'event',
  action: 'Options',
  label: '{"log":"trace","$0":"tns","profileDir":"private","bundle":"webpack"}',
  customDimensions: { cd2: 'Angular', cd9: 'false', cd5: 'CLI' },
  value: undefined
}
⠋ Getting environment information 
✔ Getting environment information 

There seem to be issues with your configuration.
⠙ Getting NativeScript components versions information...Exec npm view nativescript  dist-tags --json 
 stdout: {
  "latest": "8.4.0",
  "next": "8.4.0-next-12-04-2022-3613799910",
  "beta": "8.3.2"
}
 
 stderr: 
Using version 8.4.0. 
⠹ Getting NativeScript components versions information...Exec npm view tns-core-modules  dist-tags --json 
 stdout: {
  "latest": "6.5.27",
  "tns-next": "6.5.25-tns-next-09-28-2021-1283647697"
}
 
 stderr: 
Using version 6.5.27. 
⠙ Getting NativeScript components versions information...Exec npm view @nativescript/core  dist-tags --json 
 stdout: {
  "latest": "8.4.2",
  "next": "8.4.3-next-12-29-2022-3798656203",
  "tns": "6.5.27",
  "tns-next": "6.5.25-tns-next-09-28-2021-1283647697",
  "alpha": "8.3.0-alpha.2",
  "sap": "8.1.0-sap.0",
  "rc": "8.1.0-rc.0",
  "dom": "8.5.0-dom.2"
}
 
 stderr: 
Using version 8.4.2. 
Could not find an installed runtime, falling back to default runtimes
⠼ Getting NativeScript components versions information...Exec npm view @nativescript/android  dist-tags --json 
 stdout: {
  "rc": "8.2.0-rc.0",
  "latest": "8.4.0",
  "alpha": "8.4.0-alpha.8",
  "dev": "8.4.0-dev.2",
  "beta": "8.5.0-beta.0"
}
 
 stderr: 
Using version 8.4.0. 
⠸ Getting NativeScript components versions information...Exec npm view @nativescript/ios  dist-tags --json 
 stdout: {
  "latest": "8.4.0",
  "JSC": "6.5.6",
  "alpha": "8.4.0-alpha.3",
  "sap": "8.3.0-sap.0",
  "dev": "8.4.0-dev.1",
  "beta": "8.5.0-beta.0"
}
 
 stderr: 
Using version 8.4.0. 
✔ Getting NativeScript components versions information...
✔ Component nativescript has 8.4.0 version and is up to date.
✔ Component @nativescript/core has 8.4.2 version and is up to date.
✖ Component @nativescript/ios is not installed.
✔ Component @nativescript/android has 8.4.0 version and is up to date.
Unable to validate if project has short imports. Error is Error: ENOENT: no such file or directory, scandir '/Users/alexandredomingues/Downloads/nativeScript/ns-ng-course/node_modules/tns-core-modules'
    at Object.readdirSync (node:fs:1442:3)
    at FileSystem.readDirectory (/usr/local/lib/node_modules/nativescript/lib/common/file-system.js:189:19)
    at DoctorService.getShortImportRegExp (/usr/local/lib/node_modules/nativescript/lib/services/doctor-service.js:188:14)
    at DoctorService.getDeprecatedShortImportsInFiles (/usr/local/lib/node_modules/nativescript/lib/services/doctor-service.js:168:40)
    at DoctorService.checkForDeprecatedShortImportsInAppDir (/usr/local/lib/node_modules/nativescript/lib/services/doctor-service.js:154:43)
    at DoctorService.<anonymous> (/usr/local/lib/node_modules/nativescript/lib/services/doctor-service.js:80:18)
    at Generator.next (<anonymous>)
    at fulfilled (/usr/local/lib/node_modules/nativescript/lib/services/doctor-service.js:11:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  errno: -2,
  syscall: 'scandir',
  code: 'ENOENT',
  path: '/Users/alexandredomingues/Downloads/nativeScript/ns-ng-course/node_modules/tns-core-modules'
}
Project dir from hooksArgs is: /Users/alexandredomingues/Downloads/nativeScript/ns-ng-course.
Hooks directories: [
  '/Users/alexandredomingues/Downloads/nativeScript/ns-ng-course/hooks'
]
BeforeHookName for command checkEnvironment is before-checkEnvironment
Will send the following information to Google Analytics: {
  type: 'googleAnalyticsData',
  category: 'CLI',
  googleAnalyticsDataType: 'event',
  action: 'Check Local Build Setup',
  label: 'Starting',
  customDimensions: { cd2: 'Angular', cd9: 'false', cd5: 'CLI' },
  value: undefined
}
Error while trying to parseJson  data from /Users/alexandredomingues/.local/share/.nativescript-cli/doctor-cache.json file. Err is: SyntaxError: Unexpected end of JSON input
getInfos cacheConfig options: { forceCheck: undefined }  current info from cache:  null
Will send the following information to Google Analytics: {
  type: 'googleAnalyticsData',
  category: 'CLI',
  googleAnalyticsDataType: 'event',
  action: 'Check Local Build Setup',
  label: 'Warnings:WARNING: Xcode is not installed or is not configured properly.__WARNING: xcodeproj is not installed or is not configured properly.__WARNING: CocoaPods is not installed or is not configured properly.',
  customDimensions: { cd2: 'Angular', cd9: 'false', cd5: 'CLI' },
  value: undefined
}
✔ Your ANDROID_HOME environment variable is set and points to correct directory.
✔ Your adb from the Android SDK is correctly installed.
✔ The Android SDK is installed.
✔ A compatible Android SDK for compilation is found.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✔ CocoaPods update is not required.
✔ Your current CocoaPods version is newer than 1.0.0.
✔ Python installed and configured correctly.
✔ The Python 'six' package is found.
✖ WARNING: Xcode is not installed or is not configured properly. 
 You will not be able to build your projects for iOS or run them in the iOS Simulator.
To be able to build for iOS and run apps in the native emulator, verify that you have installed Xcode. 

✖ WARNING: xcodeproj is not installed or is not configured properly. 
 You will not be able to build your projects for iOS.
To be able to build for iOS and run apps in the native emulator, verify that you have installed xcodeproj. 

✖ WARNING: CocoaPods is not installed or is not configured properly. 
 You will not be able to build your projects for iOS if they contain plugin with CocoaPod file.
To be able to build such projects, verify that you have installed CocoaPods (`sudo gem install cocoapods`). 

Will send the following information to Google Analytics: {
  type: 'googleAnalyticsData',
  category: 'CLI',
  googleAnalyticsDataType: 'event',
  action: 'Check Local Build Setup',
  label: 'Finished: Is setup correct: false',
  customDimensions: { cd2: 'Angular', cd9: 'false', cd5: 'CLI' },
  value: undefined
}
Will send the following information to Google Analytics: {
  type: 'googleAnalyticsData',
  category: 'CLI',
  googleAnalyticsDataType: 'event',
  action: 'Check Environment Requirements',
  label: 'Non-interactive terminal, unable to execute local builds.',
  customDimensions: { cd2: 'Angular', cd9: 'false', cd5: 'CLI' },
  value: undefined
}
Your environment is not configured properly and you will not be able to execute local builds.
Verify that your environment is configured according to the system requirements described at
https://docs.nativescript.org/environment-setup.html.
Error: Your environment is not configured properly and you will not be able to execute local builds.
Verify that your environment is configured according to the system requirements described at
https://docs.nativescript.org/environment-setup.html.
    at Errors.failWithOptions (/usr/local/lib/node_modules/nativescript/lib/common/errors.js:157:27)
    at Errors.fail (/usr/local/lib/node_modules/nativescript/lib/common/errors.js:130:21)
    at PlatformEnvironmentRequirements.fail (/usr/local/lib/node_modules/nativescript/lib/services/platform-environment-requirements.js:63:22)
    at PlatformEnvironmentRequirements.<anonymous> (/usr/local/lib/node_modules/nativescript/lib/services/platform-environment-requirements.js:54:22)
    at Generator.next (<anonymous>)
    at fulfilled (/usr/local/lib/node_modules/nativescript/lib/services/platform-environment-requirements.js:11:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
Environment

No response

Please accept these terms

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the NativeScript CLI DoctorService entry points shown in lib/services/doctor-service.js and compare the environment checks from tns run android with checkEnvironment. Reproduce the reported output using the supplied macOS, CLI, Android SDK, and ANDROID_HOME details; done means the checks consistently reflect the configured Android environment or clearly identify the actual failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, javascript
Domain
cli, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.