android - NativeScript 设置失败

标签 android nativescript

我在终端中运行此命令:

tns doctor --log trace

我得到这个结果:

execFile: /Users/iyasilias/Library/Android/sdk/platform-tools/adb "help"
execFile: /Users/iyasilias/Library/Android/sdk/platform-tools/adb "help"
spawn: /Users/iyasilias/Library/Android/sdk/platform-tools/adb "--help"
Socket {
  _connecting: false,
  _hadError: false,
  _handle: 
   Pipe {
     bytesRead: 0,
     _externalStream: {},
     fd: 15,
     writeQueueSize: 0,
     owner: [Circular],
     onread: [Function: onread],
     reading: true },
  _parent: null,
  _host: null,
  _readableState: 
   ReadableState {
     objectMode: false,
     highWaterMark: 16384,
     buffer: [],
     length: 0,
     pipes: null,
     pipesCount: 0,
     flowing: null,
     ended: false,
     endEmitted: false,
     reading: true,
     sync: false,
     needReadable: true,
     emittedReadable: false,
     readableListening: false,
     resumeScheduled: false,
     defaultEncoding: 'utf8',
     ranOut: false,
     awaitDrain: 0,
     readingMore: false,
     decoder: null,
     encoding: null },
  readable: true,
  domain: null,
  _events: 
   { end: { [Function: g] listener: [Function: onend] },
     finish: [Function: onSocketFinish],
     _socketEnd: [Function: onSocketEnd],
     close: [Function] },
  _eventsCount: 4,
  _maxListeners: undefined,
  _writableState: 
   WritableState {
     objectMode: false,
     highWaterMark: 16384,
     needDrain: false,
     ending: false,
     ended: false,
     finished: false,
     decodeStrings: false,
     defaultEncoding: 'utf8',
     length: 0,
     writing: false,
     corked: 0,
     sync: true,
     bufferProcessing: false,
     onwrite: [Function],
     writecb: null,
     writelen: 0,
     bufferedRequest: null,
     lastBufferedRequest: null,
     pendingcb: 0,
     prefinished: false,
     errorEmitted: false,
     bufferedRequestCount: 0,
     corkedRequestsFree: CorkedRequest { next: null, entry: null, finish: [Function] } },
  writable: false,
  allowHalfOpen: false,
  destroyed: false,
  _bytesDispatched: 0,
  _sockname: null,
  _writev: null,
  _pendingData: null,
  _pendingEncoding: '',
  server: null,
  _server: null }
Exec uname -a 
 stdout: Darwin Muhammads-MacBook-Pro-3.local 15.6.0 Darwin Kernel Version 15.6.0: Mon Aug 29 20:21:34 PDT 2016; root:xnu-3248.60.11~1/RELEASE_X86_64 x86_64

 stderr: 
Exec npm -v 
 stdout: 3.6.0

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

Exec xcodebuild -version 
 stdout: Xcode 7.3.1
Build version 7D1014

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

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

Exec '/Users/iyasilias/Library/Android/sdk/platform-tools/adb' version 
 stdout: Android Debug Bridge version 1.0.36
Revision 8f855a3d9b35-android

 stderr: 
spawn: /Users/iyasilias/Library/Android/sdk/tools/android "-h"
Result when throw error is false:
{ stdout: '\n       Usage:\n       android [global options] action [action options]\n       Global options:\n  -s --silent     : Silent mode, shows errors only.\n  -v --verbose    : Verbose mode, shows errors, warnings and all messages.\n     --clear-cache: Clear the SDK Manager repository manifest cache.\n  -h --help       : Help on a specific command.\n\n                                                                    Valid\n                                                                    actions\n                                                                    are\n                                                                    composed\n                                                                    of a verb\n                                                                    and an\n                                                                    optional\n                                                                    direct\n                                                                    object:\n-    sdk              : Displays the SDK Manager window.\n-    avd              : Displays the AVD Manager window.\n-   list              : Lists existing targets or virtual devices.\n-   list avd          : Lists existing Android Virtual Devices.\n-   list target       : Lists existing targets.\n-   list device       : Lists existing devices.\n-   list sdk          : Lists remote SDK repository.\n- create avd          : Creates a new Android Virtual Device.\n-   move avd          : Moves or renames an Android Virtual Device.\n- delete avd          : Deletes an Android Virtual Device.\n- update avd          : Updates an Android Virtual Device to match the folders\n                        of a new SDK.\n- create project      : Creates a new Android project.\n- update project      : Updates an Android project (must already have an\n                        AndroidManifest.xml).\n- create test-project : Creates a new Android project for a test package.\n- update test-project : Updates the Android project for a test package (must\n                        already have an AndroidManifest.xml).\n- create lib-project  : Creates a new Android library project.\n- update lib-project  : Updates an Android library project (must already have\n                        an AndroidManifest.xml).\n- create uitest-project: Creates a new UI test project.\n- update adb          : Updates adb to support the USB devices declared in the\n                        SDK add-ons.\n- update sdk          : Updates the SDK by suggesting new platforms to install\n                        if available.\n',
  stderr: '',
  exitCode: 1 }
Exec mono --version 
 stdout: Mono JIT compiler version 4.2.1 (explicit/6dd2d0d Fri Nov  6 12:25:19 EST 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           normal
    SIGSEGV:       altstack
    Notification:  kqueue
    Architecture:  x86
    Disabled:      none
    Misc:          softdebug 
    LLVM:          yes(3.6.0svn-mono-(detached/a173357)
    GC:            sgen

 stderr: 
Exec git --version 
 stdout: git version 2.6.4

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

Exec "javac" -version 
 stdout:  
 stderr: javac 1.8.0_102

System information:
{ procInfo: 'nativescript/2.2.1',
  platform: 'darwin',
  os: 'Darwin Muhammads-MacBook-Pro-3.local 15.6.0 Darwin Kernel Version 15.6.0: Mon Aug 29 20:21:34 PDT 2016; root:xnu-3248.60.11~1/RELEASE_X86_64 x86_64\n',
  shell: '/bin/bash',
  dotNetVer: null,
  procArch: 'x64',
  nodeVer: 'v4.5.0',
  npmVer: '3.6.0',
  javaVer: '1.8.0',
  nodeGypVer: null,
  xcodeVer: 'Xcode 7.3.1\nBuild version 7D1014\n',
  xcodeprojGemLocation: '/Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.24.2/lib/xcodeproj.rb\n',
  itunesInstalled: true,
  cocoapodVer: null,
  adbVer: 'Android Debug Bridge version 1.0.36',
  androidInstalled: true,
  monoVer: '4.2.1',
  gitVer: '2.6.4',
  gradleVer: null,
  javacVersion: '1.8.0_102' }
Looking for project in '/Users/iyasilias'
Looking for project in '/Users'
Looking for project in '/'
No project found at or above '/Users/iyasilias'.
No project found at or above '%s' and neither was a --path specified.
Initializing analytics statuses.
Analytics statuses: 
{ TrackFeatureUsage: 1, TrackExceptions: 1 }
Trying to track feature 'CLI' with value 'doctor'.
execFile: /Users/iyasilias/Library/Android/sdk/platform-tools/adb "help"
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.
Exec pod --version 
 stdout:  
 stderr: /bin/sh: pod: command not found

Exec xcodebuild -version 
 stdout: Xcode 7.3.1
Build version 7D1014

 stderr: 
spawn: /Users/iyasilias/Library/Android/sdk/tools/android "list" "targets"
Result when throw error is false:
{ stdout: 'Available Android targets:\n----------\nid: 1 or "android-13"\n     Name: Android 3.2\n     Type: Platform\n     API level: 13\n     Revision: 1\n     Skins: WXGA (default)\n Tag/ABIs : default/armeabi\n----------\nid: 2 or "android-14"\n     Name: Android 4.0\n     Type: Platform\n     API level: 14\n     Revision: 4\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800\n Tag/ABIs : no ABIs.\n----------\nid: 3 or "android-15"\n     Name: Android 4.0.3\n     Type: Platform\n     API level: 15\n     Revision: 5\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800\n Tag/ABIs : no ABIs.\n----------\nid: 4 or "android-16"\n     Name: Android 4.1.2\n     Type: Platform\n     API level: 16\n     Revision: 5\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in\n Tag/ABIs : no ABIs.\n----------\nid: 5 or "android-17"\n     Name: Android 4.2.2\n     Type: Platform\n     API level: 17\n     Revision: 3\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in\n Tag/ABIs : no ABIs.\n----------\nid: 6 or "android-18"\n     Name: Android 4.3.1\n     Type: Platform\n     API level: 18\n     Revision: 3\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in\n Tag/ABIs : no ABIs.\n----------\nid: 7 or "android-19"\n     Name: Android 4.4.2\n     Type: Platform\n     API level: 19\n     Revision: 4\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in\n Tag/ABIs : no ABIs.\n----------\nid: 8 or "android-20"\n     Name: Android 4.4W.2\n     Type: Platform\n     API level: 20\n     Revision: 2\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in\n Tag/ABIs : no ABIs.\n----------\nid: 9 or "android-21"\n     Name: Android 5.0.1\n     Type: Platform\n     API level: 21\n     Revision: 2\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in\n Tag/ABIs : no ABIs.\n----------\nid: 10 or "android-22"\n     Name: Android 5.1.1\n     Type: Platform\n     API level: 22\n     Revision: 2\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in\n Tag/ABIs : no ABIs.\n----------\nid: 11 or "android-23"\n     Name: Android 6.0\n     Type: Platform\n     API level: 23\n     Revision: 3\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in\n Tag/ABIs : no ABIs.\n----------\nid: 12 or "android-24"\n     Name: Android 7.0\n     Type: Platform\n     API level: 24\n     Revision: 2\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in, AndroidWearRound, AndroidWearRound360x360, AndroidWearRound400x400, AndroidWearRound480x480, AndroidWearRoundChin320x290, AndroidWearRoundChin320x300, AndroidWearRoundChin360x325, AndroidWearRoundChin360x326, AndroidWearRoundChin360x330, AndroidWearSquare, AndroidWearSquare240x240, AndroidWearSquare320x320, AndroidWearRound, AndroidWearRound360x360, AndroidWearRound400x400, AndroidWearRound480x480, AndroidWearRoundChin320x290, AndroidWearRoundChin320x300, AndroidWearRoundChin360x325, AndroidWearRoundChin360x326, AndroidWearRoundChin360x330, AndroidWearSquare, AndroidWearSquare240x240, AndroidWearSquare320x320\n Tag/ABIs : android-tv/x86, android-wear/armeabi-v7a, android-wear/x86, default/arm64-v8a, default/armeabi-v7a, default/x86, default/x86_64\n----------\nid: 13 or "Google Inc.:Google APIs:21"\n     Name: Google APIs\n     Type: Add-On\n     Vendor: Google Inc.\n     Revision: 1\n     Description: Android + Google APIs\n     Based on Android 5.0.1 (API level 21)\n     Libraries:\n      * com.android.future.usb.accessory (usb.jar)\n          API for USB Accessories\n      * com.google.android.media.effects (effects.jar)\n          Collection of video effects\n      * com.google.android.maps (maps.jar)\n          API for Google Maps\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in\n Tag/ABIs : google_apis/x86\n',
  stderr: '',
  exitCode: 0 }
Available Android targets:
----------
id: 1 or "android-13"
     Name: Android 3.2
     Type: Platform
     API level: 13
     Revision: 1
     Skins: WXGA (default)
 Tag/ABIs : default/armeabi
----------
id: 2 or "android-14"
     Name: Android 4.0
     Type: Platform
     API level: 14
     Revision: 4
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800
 Tag/ABIs : no ABIs.
----------
id: 3 or "android-15"
     Name: Android 4.0.3
     Type: Platform
     API level: 15
     Revision: 5
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800
 Tag/ABIs : no ABIs.
----------
id: 4 or "android-16"
     Name: Android 4.1.2
     Type: Platform
     API level: 16
     Revision: 5
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : no ABIs.
----------
id: 5 or "android-17"
     Name: Android 4.2.2
     Type: Platform
     API level: 17
     Revision: 3
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : no ABIs.
----------
id: 6 or "android-18"
     Name: Android 4.3.1
     Type: Platform
     API level: 18
     Revision: 3
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : no ABIs.
----------
id: 7 or "android-19"
     Name: Android 4.4.2
     Type: Platform
     API level: 19
     Revision: 4
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : no ABIs.
----------
id: 8 or "android-20"
     Name: Android 4.4W.2
     Type: Platform
     API level: 20
     Revision: 2
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : no ABIs.
----------
id: 9 or "android-21"
     Name: Android 5.0.1
     Type: Platform
     API level: 21
     Revision: 2
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : no ABIs.
----------
id: 10 or "android-22"
     Name: Android 5.1.1
     Type: Platform
     API level: 22
     Revision: 2
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : no ABIs.
----------
id: 11 or "android-23"
     Name: Android 6.0
     Type: Platform
     API level: 23
     Revision: 3
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : no ABIs.
----------
id: 12 or "android-24"
     Name: Android 7.0
     Type: Platform
     API level: 24
     Revision: 2
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in, AndroidWearRound, AndroidWearRound360x360, AndroidWearRound400x400, AndroidWearRound480x480, AndroidWearRoundChin320x290, AndroidWearRoundChin320x300, AndroidWearRoundChin360x325, AndroidWearRoundChin360x326, AndroidWearRoundChin360x330, AndroidWearSquare, AndroidWearSquare240x240, AndroidWearSquare320x320, AndroidWearRound, AndroidWearRound360x360, AndroidWearRound400x400, AndroidWearRound480x480, AndroidWearRoundChin320x290, AndroidWearRoundChin320x300, AndroidWearRoundChin360x325, AndroidWearRoundChin360x326, AndroidWearRoundChin360x330, AndroidWearSquare, AndroidWearSquare240x240, AndroidWearSquare320x320
 Tag/ABIs : android-tv/x86, android-wear/armeabi-v7a, android-wear/x86, default/arm64-v8a, default/armeabi-v7a, default/x86, default/x86_64
----------
id: 13 or "Google Inc.:Google APIs:21"
     Name: Google APIs
     Type: Add-On
     Vendor: Google Inc.
     Revision: 1
     Description: Android + Google APIs
     Based on Android 5.0.1 (API level 21)
     Libraries:
      * com.android.future.usb.accessory (usb.jar)
          API for USB Accessories
      * com.google.android.media.effects (effects.jar)
          Collection of video effects
      * com.google.android.maps (maps.jar)
          API for Google Maps
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : google_apis/x86

Directories found in /Users/iyasilias/Library/Android/sdk/build-tools are 19.1.0, 20.0.0, 21.1.2, 22.0.1, 23.0.1, 23.0.2, 23.0.3, 24.0.0, 24.0.1
Versions found in /Users/iyasilias/Library/Android/sdk/build-tools are 19.1.0, 20.0.0, 21.1.2, 22.0.1, 23.0.1, 23.0.2, 23.0.3, 24.0.0, 24.0.1
Selected version is:  23.0.3
Selected targetSdk is: 23
Directories found in /Users/iyasilias/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7 are 18.0.0, 19.0.0, 19.0.1, 19.1.0, 20.0.0, 21.0.0, 21.0.2, 21.0.3, 22.0.0, 22.1.0, 22.1.1, 22.2.0, 22.2.1, 23.0.0, 23.0.1, 23.1.0, 23.1.1, 23.2.0, 23.2.1, 23.3.0, 23.4.0, 24.0.0, 24.0.0-alpha1, 24.0.0-alpha2, 24.0.0-beta1, 24.1.0, 24.1.1, 24.2.0, maven-metadata.xml, maven-metadata.xml.md5, maven-metadata.xml.sha1
Versions found in /Users/iyasilias/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7 are 18.0.0, 19.0.0, 19.0.1, 19.1.0, 20.0.0, 21.0.0, 21.0.2, 21.0.3, 22.0.0, 22.1.0, 22.1.1, 22.2.0, 22.2.1, 23.0.0, 23.0.1, 23.1.0, 23.1.1, 23.2.0, 23.2.1, 23.3.0, 23.4.0, 24.0.0, 24.0.0, 24.0.0, 24.0.0, 24.1.0, 24.1.1, 24.2.0
Selected version is:  23.4.0
Selected AppCompat version is: 23.4.0
Analytics statuses: 
{ TrackFeatureUsage: 1, TrackExceptions: 1 }
Trying to track feature 'DoctorEnvironmentSetup' with value 'incorrect'.
There seem to be issues with your configuration.

如果我运行安装脚本,我将无法安装 xcodeproj 和 cocoapods

注意:由于 Dennis Tang,第一个 $ANDROID_HOME 路径问题已得到解决

请帮忙..

最佳答案

特别是对于 $ANDROID_HOME 问题,您需要将 export ANDROID_HOME=/Users/iyasilias/Library/Android/sdk 添加到您的 ~/.bash_profile 使其在终端 session 中持续存在。

鉴于您在使用 abd 和 Cocoapods 时遇到问题,我建议再次运行 NativeScript 安装程序,让它尝试正确安装所有内容:ruby -e "$(curl -fsSL https://www.nativescript.org/setup/mac)"

编辑 xcodeproj 和 cocoapods

您应该查看 http://docs.nativescript.org/angular/start/ns-setup-os-x 上的高级安装说明

具体来说,第 3 步的第 1-4 步(令人困惑的是他们如何将编号列表嵌套在编号列表中),但它是确保安装 Xcode 和 Xcode 命令行工具的选项。

从那里,您可以安装gems,尽管我会使用sudo gem install -n/usr/local/bin xcodeproj cocoapods 而不是普通的sudo gem install 如果您使用的是 OS X El Capitan,由于 SIP 阻止您在 /usr/bin 中安装 gem。

希望之后您就可以出发了!

关于android - NativeScript 设置失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39363861/

相关文章:

android - 在尝试发送 SMS 之前检查 Android 中的网络覆盖范围

java - 调用 `invalidateViews()` 后重新绘制项目时

angular - native 脚本异常 : Failed to find module: "crypto"

Nativescript 滚动不适用于 stackLayout

android - 本地存储 API 在 NativeScript WebView 中不起作用

android - 以编程方式启用/禁用android中的数据连接

android - JPCT 加载多个对象

java - 在 try catch block 中未捕获多个 IOException 子类

objective-c - 如何在 Objective-C 中像缓冲区对象一样序列化数据以供 NativeScript 使用

nativescript - 使用 Typescript 时如何在 NativeScript 中访问 Native api