我正在尝试添加 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 上运行相同的代码时,我遇到了类似的错误。
我错过了什么?
谢谢你。
编辑:原来我有一个语法错误。更正后,一切都按预期工作。