本机脚本:TNS运行时运行时异常

时间:2019-09-24 06:07:52

标签: nativescript

当我执行tns运行android测试我的代码时,它会产生以下运行时错误:

Gradle build...
         + setting applicationId
         + applying user-defined configuration from C:\Users\Ace\eclipse-workspace\arenamaster\App_Resources\Android\app.gradle
         + using android X library androidx.legacy:legacy-support-v4:1.0.0
         + adding nativescript runtime package dependency: nativescript-optimized-with-inspector
Exception in thread "main" java.lang.RuntimeException: Class not found org.nativescript.widgets.image.Worker.OnImageLoadedListener
        at org.nativescript.staticbindinggenerator.Generator.getClass(Generator.java:549)
        at org.nativescript.staticbindinggenerator.Generator.getInterfacesFromCache(Generator.java:532)
        at org.nativescript.staticbindinggenerator.Generator.writeBinding(Generator.java:283)
        at org.nativescript.staticbindinggenerator.Generator.generateBinding(Generator.java:171)
        at org.nativescript.staticbindinggenerator.Generator.processRows(Generator.java:234)
        at org.nativescript.staticbindinggenerator.Generator.generateBindings(Generator.java:121)
        at org.nativescript.staticbindinggenerator.Generator.writeBindings(Generator.java:97)
        at org.nativescript.staticbindinggenerator.Main.main(Main.java:53)

我尝试了以下方法:
删除我的.tns.ts文件并还原代码拆分
将项目迁移到androidX
删除平台目录,然后运行tns运行android

2 个答案:

答案 0 :(得分:0)

nativescript核心模块需要一个名为nativescript核心模块小部件的软件包

如果遇到此错误,请运行e.g. : 9-25-2019 1pm, 9-25-2019 2pm, etc.

答案 1 :(得分:0)

仅需注意,对于NativeScript 7.x和更高版本,不再需要@ace zhang的答案。所有需要的是:

“ @ nativescript / core”:“ ^ 7.0.0”