I have created a native script application and trying to build using tns command(tns build android) and facing the below issue:
Project successfully prepared (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.
Execution failed for task ':app:runSbg'.
I had the same problem with the java class not found error to calander plugin, This worked well for me.
delete node_modules
, platforms
, hooks
folders and package-lock.json
file run
npm i
rebuild the project ->
tns run android
or
tns build android
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.