Nativescript错误:tns运行android - "无法找到兼容的Android SDK"

时间:2016-09-18 17:04:47

标签: android angularjs sdk nativescript tns

我遵循了整个Mac入门教程(https://docs.nativescript.org/tutorial/chapter-1)。

现在我尝试让示例应用运行。 IOS工作得很好! 但Android并不起作用:在Genymotion上不在USB设备上。

输入后输入错误: "运行android"

Executing before-prepare hook from /Users/Username/Documents/Development/sample-Groceries/hooks/before-prepare/nativescript-dev-typescript.js
Found peer TypeScript 1.8.10
Processing node_modules failed. Exception: Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later.

我安装了Android SDK 23,正如教程中所写:

android update sdk --filter tools,platform-tools,android-23,build-tools-23.0.3,extra-android-m2repository,extra-google-m2repository,extra-android-support --all --no-ui

我该如何解决?我尝试了一切......

谢谢!

1 个答案:

答案 0 :(得分:0)

我有第一个问题,你有没有运行<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml1="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:sizexenc="http://tempuri.org/sizexenc.xsd" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:sizeds="http://tempuri.org/sizeds.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:wsc="http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:chan="http://schemas.microsoft.com/ws/2005/02/duplex" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsdd="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:xmime="http://tempuri.org/xmime.xsd" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tdn="http://www.onvif.org/ver10/network/wsdl" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl"> <SOAP-ENV:Header> <wsse:Security SOAP-ENV:mustUnderstand="true"> <wsse:UsernameToken> <wsse:Username>admin</wsse:Username> <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">iZGOClWegnxwfuolWSakKIYyVRk=</wsse:Password> <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">0bGB7IsWkEi0xhHgctiHixYHAAAAAA==</wsse:Nonce> <wsu:Created>2016-09-19T15:12:49.009Z</wsu:Created> </wsse:UsernameToken> </wsse:Security> </SOAP-ENV:Header> <SOAP-ENV:Body> <tds:GetServicesResponse> <tds:Service xsi:type="tds:Service"> <tds:Namespace>http://www.onvif.org/ver10/device/wsdl</tds:Namespace> <tds:XAddr>http://******:1881/</tds:XAddr> <tds:Version xsi:type="tt:OnvifVersion"> <tt:Major>2</tt:Major> <tt:Minor>5</tt:Minor> </tds:Version> </tds:Service> <tds:Service xsi:type="tds:Service"> <tds:Namespace>http://www.onvif.org/ver10/media/wsdl</tds:Namespace> <tds:XAddr>http://******:1906/</tds:XAddr> <tds:Version xsi:type="tt:OnvifVersion"> <tt:Major>2</tt:Major> <tt:Minor>6</tt:Minor> </tds:Version> </tds:Service> <tds:Service xsi:type="tds:Service"> <tds:Namespace>http://www.onvif.org/ver10/deviceIO/wsdl</tds:Namespace> <tds:XAddr>http://******:1931/</tds:XAddr> <tds:Version xsi:type="tt:OnvifVersion"> <tt:Major>2</tt:Major> <tt:Minor>6</tt:Minor> </tds:Version> </tds:Service> </tds:GetServicesResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

确保正确设置ANDROID_HOME,指向实际的sdk安装位置,最后没有尾部斜杠。以我的为例:

tns doctor

在路径中使用工具也很好(示例代码段):

ANDROID_HOME=/sdks/android-sdk-macosx