Native Script App build:gradle构建时面临的问题

时间:2018-06-09 17:21:45

标签: java android gradle nativescript angular2-nativescript

我创建了一个本机脚本应用程序并尝试使用tns命令构建(tns build android)并面临以下问题:

项目成功准备(android)

Building project...

Gradle build...

+ setting applicationId

+ applying user-defined configuration from C:\project_repo\helper_mobile_app\helper\app\App_Resources\Android\app.gradle

Applying settings from C:\project_repo\helper_mobile_app\helper\app\App_Resources\Android\settings.json

+ adding nativescript runtime package dependency: nativescript-optimized-with-inspector

+ adding aar plugin dependency: C:\project_repo\helper_mobile_app\helper\node_modules\tns-core-modules-widgets\platforms\android\widgets-release.aar

Exception in thread "main" java.lang.SecurityException: java.lang.AbstractStringBuilder - protected system package 'java.lang'

at java.lang.ClassLoader.checkClassName(ClassLoader.java:292)

at java.lang.ClassLoader.defineClass(ClassLoader.java:334)

at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:154)

at java.net.URLClassLoader.defineClass(URLClassLoader.java:727)

at java.net.URLClassLoader.access$400(URLClassLoader.java:95)

at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:1182)

at java.security.AccessController.doPrivileged(AccessController.java:686)

at java.net.URLClassLoader.findClass(URLClassLoader.java:602)

at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:846)

at java.lang.ClassLoader.loadClass(ClassLoader.java:825)

at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:1220)

at java.lang.ClassLoader.loadClass(ClassLoader.java:805)

at org.nativescript.staticbindinggenerator.GetInterfaceNames.generateInterfaceNames(GetInterfaceNames.java:59)

at org.nativescript.staticbindinggenerator.GetInterfaceNames.generateInterfaceFile(GetInterfaceNames.java:32)

at org.nativescript.staticbindinggenerator.Main.main(Main.java:42)

FAILURE: Build failed with an exception.
  • 出了什么问题:

任务执行失败':app:runSbg'。

1 个答案:

答案 0 :(得分:0)

我与calander插件的java类未找到错误有相同的问题, 这对我来说很好。

删除node_modulesplatformshooks文件夹和package-lock.json文件 运行

npm i

重建项目->

tns run android

tns build android