Nativescript: You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system.

Created on 11 Jul 2017  ยท  11Comments  ยท  Source: NativeScript/NativeScript

Hello,

Trying use NativeScript, I got the following error on Macbook running OSX Sierra 10.12.5:

You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system.

I have installed Android Studio and many SDK versions, also extras.

Output of tns doctor --trace

tns doctor --log trace
Loading extensions.
execFile: /usr/local/Caskroom/android-sdk/3859397/platform-tools/adb "help"
Exec uname -a
 stdout: Darwin Marian0-2.local 16.6.0 Darwin Kernel Version 16.6.0: Fri Apr 14 16:21:16 PDT 2017; root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64

 stderr:
Exec npm -v
 stdout: 4.2.0

 stderr:
spawn: java "-version"
Exec node-gyp -v
 stdout:
 stderr: /bin/sh: node-gyp: command not found

Exec xcodebuild -version
 stdout: Xcode 8.3.3
Build version 8E3004b

 stderr:
Exec gem which xcodeproj
 stdout: /Library/Ruby/Gems/2.0.0/gems/xcodeproj-1.5.0/lib/xcodeproj.rb

 stderr:
Exec pod --version
 stdout: 1.2.1

 stderr:
Exec '/usr/local/Caskroom/android-sdk/3859397/platform-tools/adb' version
 stdout: Android Debug Bridge version 1.0.39
Revision 3db08f2c6889-android
Installed as /usr/local/Caskroom/android-sdk/3859397/platform-tools/adb

 stderr:
spawn: /usr/local/Caskroom/android-sdk/3859397/emulator/emulator "-help"
Result when throw error is false:
{ stdout: 'Android Emulator usage: emulator [options] [-qemu args]\n  options:\n    -list-avds                     list available AVDs\n    -sysdir <dir>                  search for system disk images in <dir>\n    -system <file>                 read initial system image from <file>\n    -writable-system               make system image writable after \'adb remount\'\n    -datadir <dir>                 write user data into <dir>\n    -kernel <file>                 use specific emulated kernel\n    -ramdisk <file>                ramdisk image (default <system>/ramdisk.img\n    -image <file>                  obsolete, use -system <file> instead\n    -initdata <file>               same as \'-init-data <file>\'\n    -data <file>                   data image (default <datadir>/userdata-qemu.img\n    -partition-size <size>         system/data partition size in MBs\n    -cache <file>                  cache partition image (default is temporary file)\n    -cache-size <size>             cache partition size in MBs\n    -no-cache                      disable the cache partition\n    -nocache                       same as -no-cache\n    -sdcard <file>                 SD card image (default <datadir>/sdcard.img\n    -snapstorage <file>            file that contains all state snapshots (default <datadir>/snapshots.img)\n    -no-snapstorage                do not mount a snapshot storage file (this disables all snapshot functionality)\n    -snapshot <name>               name of snapshot within storage file for auto-start and auto-save (default \'default-boot\')\n    -no-snapshot                   perform a full boot and do not do not auto-save, but qemu vmload and vmsave operate on snapstorage\n    -no-snapshot-save              do not auto-save to snapshot on exit: abandon changed state\n    -no-snapshot-load              do not auto-start from snapshot: perform a full boot\n    -snapshot-list                 show a list of available snapshots\n    -no-snapshot-update-time       do not do try to correct snapshot time on restore\n    -wipe-data                     reset the user data image (copy it from initdata)\n    -avd <name>                    use a specific android virtual device\n    -skindir <dir>                 search skins in <dir> (default <system>/skins)\n    -skin <name>                   select a given skin\n    -no-skin                       deprecated: create an AVD with no skin instead\n    -noskin                        same as -no-skin\n    -memory <size>                 physical RAM size in MBs\n    -cores <number>                Set number of CPU cores to emulator\n    -accel <mode>                  Configure emulation acceleration\n    -no-accel                      Same as \'-accel off\'\n    -ranchu                        Use new emulator backend instead of the classic one\n    -engine <engine>               Select engine. auto|classic|qemu2\n    -netspeed <speed>              maximum network download/upload speeds\n    -netdelay <delay>              network latency emulation\n    -netfast                       disable network shaping\n    -code-profile <name>           enable code profiling\n    -show-kernel                   display kernel messages\n    -shell                         enable root shell on current terminal\n    -no-jni                        disable JNI checks in the Dalvik runtime\n    -nojni                         same as -no-jni\n    -logcat <tags>                 enable logcat output with given tags\n    -no-audio                      disable audio support\n    -noaudio                       same as -no-audio\n    -audio <backend>               use specific audio backend\n    -radio <device>                redirect radio modem interface to character device\n    -port <port>                   TCP port that will be used for the console\n    -ports <consoleport>,<adbport> TCP ports used for the console and adb bridge\n    -onion <image>                 use overlay PNG image over screen\n    -onion-alpha <%age>            specify onion-skin translucency\n    -onion-rotation 0|1|2|3        specify onion-skin rotation\n    -dpi-device <dpi>              specify device\'s resolution in dpi (default 165)\n    -scale <scale>                 scale emulator window (deprecated)\n    -http-proxy <proxy>            make TCP connections through a HTTP/HTTPS proxy\n    -timezone <timezone>           use this timezone instead of the host\'s default\n    -dns-server <servers>          use this DNS server(s) in the emulated system\n    -cpu-delay <cpudelay>          throttle CPU emulation\n    -no-boot-anim                  disable animation for faster boot\n    -no-window                     disable graphical window display\n    -version                       display emulator version number\n    -report-console <socket>       report console port to remote socket\n    -gps <device>                  redirect NMEA GPS to character device\n    -shell-serial <device>         specific character device for root shell\n    -tcpdump <file>                capture network packets to file\n    -bootchart <timeout>           enable bootcharting\n    -charmap <file>                use specific key character map\n    -prop <name>=<value>           set system property on boot\n    -shared-net-id <number>        join the shared network, using IP address 10.1.2.<number>\n    -nand-limits <nlimits>         enforce NAND/Flash read/write thresholds\n    -gpu <mode>                    set hardware OpenGLES emulation mode\n    -camera-back <mode>            set emulation mode for a camera facing back\n    -camera-front <mode>           set emulation mode for a camera facing front\n    -webcam-list                   lists web cameras available for emulation\n    -screen <mode>                 set emulated screen mode\n    -force-32bit                   always use 32-bit emulator\n    -selinux <disabled|permissive> Set SELinux to either disabled or permissive mode\n    -unix-pipe <path>              Add <path> to the list of allowed Unix pipes\n    -fixed-scale                   Use fixed 1:1 scale for the initial emulator window.\n    -wait-for-debugger             Pause on launch and wait for a debugger process to attach before resuming\n    -skip-adb-auth                 Skip adb authentication dialogue\n\n     -qemu args...                 pass arguments to qemu\n     -qemu -h                      display qemu help\n\n     -verbose                      same as \'-debug-init\'\n     -debug <tags>                 enable/disable debug messages\n     -debug-<tag>                  enable specific debug messages\n     -debug-no-<tag>               disable specific debug messages\n\n     -help                         print this help\n     -help-<option>                print option-specific help\n\n     -help-disk-images             about disk images\n     -help-debug-tags              debug tags for -debug <tags>\n     -help-char-devices            character <device> specification\n     -help-environment             environment variables\n     -help-virtual-device          virtual device management\n     -help-sdk-images              about disk images when using the SDK\n     -help-build-images            about disk images when building Android\n     -help-all                     prints all help content\n\n',
  stderr: '',
  exitCode: 0 }
The result of checking is Android Emulator installed is:
- stdout: Android Emulator usage: emulator [options] [-qemu args]
  options:
    -list-avds                     list available AVDs
    -sysdir <dir>                  search for system disk images in <dir>
    -system <file>                 read initial system image from <file>
    -writable-system               make system image writable after 'adb remount'
    -datadir <dir>                 write user data into <dir>
    -kernel <file>                 use specific emulated kernel
    -ramdisk <file>                ramdisk image (default <system>/ramdisk.img
    -image <file>                  obsolete, use -system <file> instead
    -initdata <file>               same as '-init-data <file>'
    -data <file>                   data image (default <datadir>/userdata-qemu.img
    -partition-size <size>         system/data partition size in MBs
    -cache <file>                  cache partition image (default is temporary file)
    -cache-size <size>             cache partition size in MBs
    -no-cache                      disable the cache partition
    -nocache                       same as -no-cache
    -sdcard <file>                 SD card image (default <datadir>/sdcard.img
    -snapstorage <file>            file that contains all state snapshots (default <datadir>/snapshots.img)
    -no-snapstorage                do not mount a snapshot storage file (this disables all snapshot functionality)
    -snapshot <name>               name of snapshot within storage file for auto-start and auto-save (default 'default-boot')
    -no-snapshot                   perform a full boot and do not do not auto-save, but qemu vmload and vmsave operate on snapstorage
    -no-snapshot-save              do not auto-save to snapshot on exit: abandon changed state
    -no-snapshot-load              do not auto-start from snapshot: perform a full boot
    -snapshot-list                 show a list of available snapshots
    -no-snapshot-update-time       do not do try to correct snapshot time on restore
    -wipe-data                     reset the user data image (copy it from initdata)
    -avd <name>                    use a specific android virtual device
    -skindir <dir>                 search skins in <dir> (default <system>/skins)
    -skin <name>                   select a given skin
    -no-skin                       deprecated: create an AVD with no skin instead
    -noskin                        same as -no-skin
    -memory <size>                 physical RAM size in MBs
    -cores <number>                Set number of CPU cores to emulator
    -accel <mode>                  Configure emulation acceleration
    -no-accel                      Same as '-accel off'
    -ranchu                        Use new emulator backend instead of the classic one
    -engine <engine>               Select engine. auto|classic|qemu2
    -netspeed <speed>              maximum network download/upload speeds
    -netdelay <delay>              network latency emulation
    -netfast                       disable network shaping
    -code-profile <name>           enable code profiling
    -show-kernel                   display kernel messages
    -shell                         enable root shell on current terminal
    -no-jni                        disable JNI checks in the Dalvik runtime
    -nojni                         same as -no-jni
    -logcat <tags>                 enable logcat output with given tags
    -no-audio                      disable audio support
    -noaudio                       same as -no-audio
    -audio <backend>               use specific audio backend
    -radio <device>                redirect radio modem interface to character device
    -port <port>                   TCP port that will be used for the console
    -ports <consoleport>,<adbport> TCP ports used for the console and adb bridge
    -onion <image>                 use overlay PNG image over screen
    -onion-alpha <%age>            specify onion-skin translucency
    -onion-rotation 0|1|2|3        specify onion-skin rotation
    -dpi-device <dpi>              specify device's resolution in dpi (default 165)
    -scale <scale>                 scale emulator window (deprecated)
    -http-proxy <proxy>            make TCP connections through a HTTP/HTTPS proxy
    -timezone <timezone>           use this timezone instead of the host's default
    -dns-server <servers>          use this DNS server(s) in the emulated system
    -cpu-delay <cpudelay>          throttle CPU emulation
    -no-boot-anim                  disable animation for faster boot
    -no-window                     disable graphical window display
    -version                       display emulator version number
    -report-console <socket>       report console port to remote socket
    -gps <device>                  redirect NMEA GPS to character device
    -shell-serial <device>         specific character device for root shell
    -tcpdump <file>                capture network packets to file
    -bootchart <timeout>           enable bootcharting
    -charmap <file>                use specific key character map
    -prop <name>=<value>           set system property on boot
    -shared-net-id <number>        join the shared network, using IP address 10.1.2.<number>
    -nand-limits <nlimits>         enforce NAND/Flash read/write thresholds
    -gpu <mode>                    set hardware OpenGLES emulation mode
    -camera-back <mode>            set emulation mode for a camera facing back
    -camera-front <mode>           set emulation mode for a camera facing front
    -webcam-list                   lists web cameras available for emulation
    -screen <mode>                 set emulated screen mode
    -force-32bit                   always use 32-bit emulator
    -selinux <disabled|permissive> Set SELinux to either disabled or permissive mode
    -unix-pipe <path>              Add <path> to the list of allowed Unix pipes
    -fixed-scale                   Use fixed 1:1 scale for the initial emulator window.
    -wait-for-debugger             Pause on launch and wait for a debugger process to attach before resuming
    -skip-adb-auth                 Skip adb authentication dialogue

     -qemu args...                 pass arguments to qemu
     -qemu -h                      display qemu help

     -verbose                      same as '-debug-init'
     -debug <tags>                 enable/disable debug messages
     -debug-<tag>                  enable specific debug messages
     -debug-no-<tag>               disable specific debug messages

     -help                         print this help
     -help-<option>                print option-specific help

     -help-disk-images             about disk images
     -help-debug-tags              debug tags for -debug <tags>
     -help-char-devices            character <device> specification
     -help-environment             environment variables
     -help-virtual-device          virtual device management
     -help-sdk-images              about disk images when using the SDK
     -help-build-images            about disk images when building Android
     -help-all                     prints all help content


- stderr:
Exec mono --version
 stdout:
 stderr: /bin/sh: mono: command not found

Exec git --version
 stdout: git version 2.11.0 (Apple Git-81)

 stderr:
Exec gradle -v
 stdout:
 stderr: /bin/sh: gradle: command not found

Exec "/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/javac" -version
 stdout:
 stderr: javac 1.8.0_65

System information:
{ procInfo: 'nativescript/3.1.2',
  platform: 'darwin',
  os: 'Darwin Marian0-2.local 16.6.0 Darwin Kernel Version 16.6.0: Fri Apr 14 16:21:16 PDT 2017; root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64\n',
  shell: '/bin/zsh',
  dotNetVer: null,
  procArch: 'x64',
  nodeVer: 'v7.8.0',
  npmVer: '4.2.0',
  javaVer: '1.8.0',
  nodeGypVer: null,
  xcodeVer: 'Xcode 8.3.3\nBuild version 8E3004b\n',
  xcodeprojGemLocation: '/Library/Ruby/Gems/2.0.0/gems/xcodeproj-1.5.0/lib/xcodeproj.rb\n',
  itunesInstalled: true,
  cocoapodVer: '1.2.1',
  adbVer: 'Android Debug Bridge version 1.0.39',
  emulatorInstalled: true,
  monoVer: null,
  gitVer: '2.11.0 (Apple Git-81)',
  gradleVer: null,
  javacVersion: '1.8.0_65' }
Looking for project in '/Users/Mariano/Sites/Groceries'
Project directory is '/Users/Mariano/Sites/Groceries'.
Initializing analytics statuses.
Analytics statuses:
{ TrackFeatureUsage: 1, TrackExceptions: 1 }
Trying to track feature 'CLI' with value 'doctor'.
execFile: /usr/local/Caskroom/android-sdk/3859397/platform-tools/adb "help"
Verifying CocoaPods. This may take more than a minute, please be patient.
spawn: npm "install" "tns-ios" "--global" "false" "--production" "--save" "--ignoreScripts" "--ignore-scripts"
[email protected] /private/var/folders/9_/l7vzzjj17sbdrgj4j525f8f00000gn/T/nativescript-check-cocoapods117611-12574-wqv3tr.xgv3l0izfr
โ””โ”€โ”€ [email protected]

npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
spawn: npm "install" "tns-ios" "--global" "false" "--production" "--save" "--ignoreScripts" "--ignore-scripts" "--json" "--dry-run" "--prefix" "/var/folders/9_/l7vzzjj17sbdrgj4j525f8f00000gn/T/nativescript-check-cocoapods117611-12574-wqv3tr.xgv3l0izfr"
spawn: pod "install"
  โ—œ Verifying CocoaPods. This may take some time, please be patient.Result when throw error is false:
{ stdout: 'Analyzing dependencies\nDownloading dependencies\nInstalling AFNetworking (1.3.4)\nGenerating Pods project\nIntegrating client project\n\n[!] Please close any current Xcode sessions and use `__PROJECT_NAME__.xcworkspace` for this project from now on.\nSending stats\nPod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.\n',
  stderr: '\n[!] Automatically assigning platform ios with version 8.0 on target __PROJECT_NAME__ because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.\n',
  exitCode: 0 }
  โ— Verifying CocoaPods. This may take some time, please be patient.
Exec xcodebuild -version
 stdout: Xcode 8.3.3
Build version 8E3004b

 stderr:
Installed Android Targets are:  [ 'android-17',
  'android-18',
  'android-19',
  'android-21',
  'android-22',
  'android-23',
  'android-24',
  'android-25' ]
Directories found in /usr/local/Caskroom/android-sdk/3859397/build-tools are 25.0.2, 26.0.0
Versions found in /usr/local/Caskroom/android-sdk/3859397/build-tools are 25.0.2, 26.0.0
Selected version is:  25.0.2
Selected targetSdk is: 25
Selected version is:  undefined
Selected AppCompat version is: undefined
Path to Android SDK Management tool is: /usr/local/Caskroom/android-sdk/3859397/tools/bin/sdkmanager
You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system.
Run $ $ANDROID_HOME/tools/bin/sdkmanager to manage the Android Support Repository.

Exec python -c "import six"
 stdout:
 stderr:
Analytics statuses:
{ TrackFeatureUsage: 1, TrackExceptions: 1 }
Trying to track feature 'DoctorEnvironmentSetup' with value 'incorrect'.
There seem to be issues with your configuration.
? Do you want to visit the official documentation? No
? Do you want to run the setup script? No
Exec npm view nativescript  dist-tags --json
 stdout: {
  "latest": "3.1.2",
  "next": "3.2.0-2017-07-11-9404",
  "rc": "3.1.2-2017-07-05-9364"
}

 stderr:
Using version 3.1.2.
Exec npm view tns-core-modules  dist-tags --json
 stdout: {
  "latest": "3.1.0",
  "next": "3.2.0-2017-7-11-7",
  "rc": "3.1.0"
}

 stderr:
Using version 3.1.0.
Exec npm view tns-ios  dist-tags --json
 stdout: {
  "latest": "3.1.0",
  "next": "3.2.0-2017-7-5-5",
  "rc": "3.1.0"
}

 stderr:
Using version 3.1.0.
Exec npm view tns-android  dist-tags --json
 stdout: {
  "latest": "3.1.1",
  "next": "3.2.0-2017-7-11-2",
  "rc": "3.1.0"
}

 stderr:
Using version 3.1.1.
Your components are up-to-date.

When you file an issue, these warnings will help the NativeScript team to investigate, identify, and resolve the report.
Please, ignore them if you are not experiencing any issues with NativeScript.

Also, tns info

All NativeScript components versions information
โ”‚ Component        โ”‚ Current version โ”‚ Latest version โ”‚ Information   โ”‚
โ”‚ nativescript     โ”‚ 3.1.2           โ”‚ 3.1.2          โ”‚ Up to date    โ”‚
โ”‚ tns-core-modules โ”‚ 3.1.0           โ”‚ 3.1.0          โ”‚ Up to date    โ”‚
โ”‚ tns-android      โ”‚                 โ”‚ 3.1.1          โ”‚ Not installed โ”‚
โ”‚ tns-ios          โ”‚ 3.1.0           โ”‚ 3.1.0          โ”‚ Up to date    โ”‚

I've looked into many forums and I didn't found a solution.

Thanks in advance.

android

Most helpful comment

Hello @tsonevn, thank you!

I got solved that issue by changing my ANDROID_HOME. I've noticed that this happens when you install Android Studio before installing Native Script. For some reason, the paths are different. So, to make it work what I did is, in command line:

export ANDROID_HOME=/Users/<mi username>/Library/Android/sdk

After that, tns doctor are not throwing errors anymore. Maybe this would be useful for other people.

Regards,

All 11 comments

Hi @Marian0,
First of all, thank you for your interest in NativeScript.
Regarding the problem, please make sure you have Android SDK Build Tools 25.0.2 installed, as it is described in the advanced installation gidelines here.
Also, you could verify whether the Android support repository is installed. (You can find it under Extras section in Android SDK Manager)

Hello @tsonevn, thank you!

I got solved that issue by changing my ANDROID_HOME. I've noticed that this happens when you install Android Studio before installing Native Script. For some reason, the paths are different. So, to make it work what I did is, in command line:

export ANDROID_HOME=/Users/<mi username>/Library/Android/sdk

After that, tns doctor are not throwing errors anymore. Maybe this would be useful for other people.

Regards,

Thank you @Marian0 , life saver ๐Ÿ‘

In my case I had SDK 26, but didn't have AppCompat 26 (there's no such thing), so I had to make a step back and use SDK 25. For that I ran tns run android --compileSdk 25.

You can find what exactly is wrong by running tns doctor --log trace

Thanks @Marian0!

tns run android --compileSdk 28 works for me

my android home is set to where android studio installed it

echo $ANDROID_HOME
/Users/<my username>/Library/Android/sdk

I have build tools for 27 and 28

ls $ANDROID_HOME/build-tools/
27.0.3 28.0.2

But I still get the error

You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system.

My issue was that I only had the Android API 28 installed, I needed to install Oreo 27 for the nativescript sidekick to be able to detect my running emulator

By running the command from the NS page I was able to get it to work:

$ANDROID_HOME/tools/bin/sdkmanager "tools" "emulator" "platform-tools" "platforms;android-25" "build-tools;27.0.3" "extras;android;m2repository" "extras;google;m2repository"

As I can see having sdk platform 25 does the trick.

updating SDK in AndroidStudio >> Preferenceswould help
screen shot 2018-10-16 at 3 25 26 am

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

guillaume-roy picture guillaume-roy  ยท  3Comments

Leo-lay picture Leo-lay  ยท  3Comments

NickIliev picture NickIliev  ยท  3Comments

vtisnado picture vtisnado  ยท  3Comments

NordlingDev picture NordlingDev  ยท  3Comments