代码之家  ›  专栏  ›  技术社区  ›  Robert Williams

访问NativeScript中的Android软件包时出现问题

  •  0
  • Robert Williams  · 技术社区  · 6 年前

    作为 documentation 建议:

    android.view 包授予对类的访问权限,如 android.view.View -Android中所有视图元素的基础。

    enter image description here

    Error: Cannot find name 'android'

    1 回复  |  直到 6 年前
        1
  •  3
  •   Nick Iliev    6 年前

    在使用TypeScript时(如果您想对本机api使用intelliSense,甚至可以使用纯JavaScript),您需要有显式声明(通常来自扩展名为*.d.ts的typings文件)。在同一篇文档文章中,您提到

    注意:要访问和智能感知本机API,请使用 NativeScript+TypeScript或NativeScript+Angular项目 将开发人员依赖项添加到 tns-platform-declarations . 更多细节 here .

    使用方法的详细说明 tns平台声明 也可以找到 here in the plugin's instructions