我正在尝试添加nativescript-telerik-ui,并在一个空白项目中使用侧边抽屉。项目可以正确构建,但如果我尝试在连接的设备上运行代码,则会出现以下错误:

在我尝试使用其中一个页面上的抽屉之前,项目一直运行正常。
这是我的package.json:
{
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
"id": "org.nativescript.drawertest",
"tns-android": {
"version": "2.4.1"
}
},
"dependencies": {
"nativescript-telerik-ui": "^1.5.1",
"nativescript-theme-core": "^0.2.1",
"tns-core-modules": "2.4.4"
},
"devDependencies": {
"babel-traverse": "6.21.0",
"babel-types": "6.21.0",
"babylon": "6.14.1",
"lazy": "1.0.11",
"nativescript-dev-android-snapshot": "^0.*.*"
}
}
我也尝试过在Genymotion中运行它。下面是我得到的错误:
An uncaught Exception occurred on "main" thread.
java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.drawertest/com.tns.NativeScriptActivity}: com.tns.NativeScriptException:
Calling js method onCreate failed
Error: Building UI from XML. @file:///app/main-page.xml:20:5
> Module 'ui/rad-side-drawer' not found for element 'RadSideDrawer'.
> com.tns.NativeScriptException: Failed to find module: "ui/rad-side-drawer", relative to: app/tns_modules/
com.tns.Module.resolvePathHelper(Module.java:159)
com.tns.Module.resolvePath(Module.java:60)
com.tns.Runtime.callJSMethodNative(Native Method)
com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1022)
com.tns.Runtime.callJSMethodImpl(Runtime.java:907)
com.tns.Runtime.callJSMethod(Runtime.java:895)
com.tns.Runtime.callJSMethod(Runtime.java:879)
com.tns.Runtime.callJSMethod(Runtime.java:871)
com.tns.NativeScriptActivity.onCreate(android.app.Activity.java)
android.app.Activity.performCreate(
我可能应该提一下,当我试图使用ios模拟器在mac上运行相同的代码时,我得到了类似的错误。
我遗漏了什么?
谢谢。
编辑:原来我有一个语法错误。更正后,一切都如预期的那样工作。
发布于 2016-12-29 20:56:44
从错误日志中可以看出,您为RadSideDrawer组件声明了一个不正确的名称空间抽屉(“ui/rad-side-”)。该组件是nativescript-telerik-ui插件的一部分,该插件可以在node_modules文件夹中的nativescript-telerik-ui-pro/sidedrawer模块中找到。
有关更多详细信息,请查看官方文档here。
只需声明此名称空间,并在XML中声明RadSideDrawer时使用它:
xmlns:drawer="nativescript-telerik-ui-pro/sidedrawer"https://stackoverflow.com/questions/41351851
复制相似问题