NetBeans Clean & Build Android Error: Accessing Java.Lang X500Principal

I am wondering if anyone can help with this. An error occurs when cleaning and building simple projects. (see below)

Steps leading to the error:

As a new employee and, therefore, a new user on a machine no older than 4 months old, I started by opening NetBeans 8.2 - both for NetBeans and Android Studio (for sdk), installed for me a week before.

However, the Android plugin is not installed, so I installed nbandroid update center to install the plugin. Then I connected sdk - found in users \ user.user1 \ AppData \ local \ android folder - to NetBeans.

To run the correct Android version (4.2.2) of a specific project, I first installed version 4 in Android Studio / SDK Manager, before choosing 4.2.2 in NetBeans.

I started copying the android project from a shared file server to the local computer before opening the local version in NetBeans.

After performing cleaning and assembly, the following error occurs (you may notice that there are folder structures that differ from those described above. This is due to testing various configurations to find a possible solution):

Current build type is different than previous build: forced apkbuilder run. Creating Test-debug-unaligned.apk and signing it with a debug key... C:\AndroidSDK\tools\ant\build.xml:958: The following error occurred while executing this line: C:\AndroidSDK\tools\ant\build.xml:969: The following error occurred while executing this line: C:\AndroidSDK\tools\ant\build.xml:312: java.lang.InternalError: Could not obtain X500Principal access at sun.security.x509.X500Name.<clinit>(X500Name.java:1399) at com.android.sdklib.internal.build.SignedJarBuilder.writeSignatureBlock(SignedJarBuilder.java:384) at com.android.sdklib.internal.build.SignedJarBuilder.close(SignedJarBuilder.java:273) at com.android.sdklib.build.ApkBuilder.sealApk(ApkBuilder.java:795) at com.android.ant.ApkBuilderTask.execute(ApkBuilderTask.java:371) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293) at sun.reflect.GeneratedMethodAccessor147.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293) at sun.reflect.GeneratedMethodAccessor147.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:396) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293) at sun.reflect.GeneratedMethodAccessor147.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68) at com.android.ant.IfElseTask.execute(IfElseTask.java:124) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293) at sun.reflect.GeneratedMethodAccessor147.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68) at com.android.ant.IfElseTask.execute(IfElseTask.java:124) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293) at sun.reflect.GeneratedMethodAccessor147.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293) at sun.reflect.GeneratedMethodAccessor147.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:396) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293) at sun.reflect.GeneratedMethodAccessor147.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:435) at org.apache.tools.ant.Target.performTasks(Target.java:456) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405) at org.apache.tools.ant.Project.executeTarget(Project.java:1376) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1260) at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286) at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555) at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153) Caused by: java.security.PrivilegedActionException: java.lang.NoSuchMethodException: javax.security.auth.x500.X500Principal.<init>(sun.security.x509.X500Name) at java.security.AccessController.doPrivileged(Native Method) at sun.security.x509.X500Name.<clinit>(X500Name.java:1392) ... 63 more Caused by: java.lang.NoSuchMethodException: javax.security.auth.x500.X500Principal.<init>(sun.security.x509.X500Name) at java.lang.Class.getConstructor0(Class.java:3082) at java.lang.Class.getDeclaredConstructor(Class.java:2178) at sun.security.x509.X500Name$1.run(X500Name.java:1384) at sun.security.x509.X500Name$1.run(X500Name.java:1380) 

This is really strange due to the fact that my colleague has no problems compiling on his PC (almost identical to the PC, with the exception of NetBeans 8.1 and Jdk8u91 instead of my last java)

Solutions have already been consulted:

  • Change the location of the Android SDK, JDK and all related applications,
  • Insert environment variables such as ANT_HOME, JAVA_HOME and ANDROID_HOME,
  • Installing all plugins and versions of Android,

  • Insert environment variable path in Jdk,

  • Installing exclusively 4.2.2 version of Android in android studio,

  • Complete the cleanup and reinstallation of NetBeans, Android Studio, JDK, Android SDK as Pc Administrator,

  • Using my colleague as a user,

  • Cleaning and creating simple startup projects,

  • Configure NetBeans identical logins as my peers,

  • Explore the depths of Google

I checked the permissions and got a little familiar with the principles and tools of Java, but I'm not 100% sure what I am doing with it.

Thought I'd advise the stack before trying anything else. Any help is appreciated.

+5
source share
2 answers

The nbandroid plugin is not compatible with wiki-based NetBeans 8.2, which talks about its NetBeans 8.1 nbandroid wiki , and also an error was recorded for the same problem on the nbandroid plugin site here .

Once they updated the plugin to work with a newer version of NetBeans, I would expect this to be allowed.

+1
source

Agreeing with @RandykaYudhistira in the comments, it was decided to downgrade to 8.1, and this completely resolved the problem, allowing me to clean and create new and local applications.

Success

However, this does not solve the problem with NetBeans 8.2. It would be interesting to know if there is a solution to this problem, and why settings like mine and others have this problem.

Any other decisions are welcome - decide, not "work," as I am here.

0
source

Source: https://habr.com/ru/post/1258204/


All Articles