【发布时间】:2016-12-27 20:32:23
【问题描述】:
我正在尝试添加 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 上运行相同的代码时,我遇到了类似的错误。
我错过了什么?
谢谢。
编辑:原来我有一个语法错误。更正后,一切都按预期工作。
【问题讨论】:
-
也放 xml 代码 :) 可能你错过了 xlmns:Drawer 或类似的东西
-
@MarekMaszay:好电话。我开始查看 xml,但确实有语法错误。
标签: nativescript nativescript-telerik-ui