Zeenglishking Zeenglishking - 13 days ago 12
Android Question

NetBeans Clean & Build Android error: Java.Lang X500Principal access

I’m wondering if anyone can help on this one. An error occurs when cleaning and building the simplest of projects. (see below)

Steps leading to error:

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

There was no Android plugin installed however, so I implemented the nbandroid update centre to install the plugin. I then connected the sdk - found in users\user.user1\AppData\local\android folder - to NetBeans.

In order to run the correct Android version (4.2.2) of a certain project, I firstly installed the versions 4 and up in Android Studio/SDK Manager, before selecting the 4.2.2 in NetBeans.

I proceeded to copy an android project from a shared file server to my local machine before opening the local version in NetBeans.

After Executing a Clean & Build the following error occurs (You may note that there are folder structures that are different to what is stated above. This is due to the testing of different 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 my colleague having no problems compiling on his PC (almost identical PC except with NetBeans 8.1 and Jdk8u91 instead of my latest java)

Solutions already consulted:


  • Change of locations of Android SDK,JDK, and all relevant
    applications,

  • Inserting of Environment Variables such as ANT_HOME,
    JAVA_HOME and ANDROID_HOME,

  • Installing all plugins and android versions ,

  • Inserting Environment Variable Path to the Jdk,

  • Installing solely 4.2.2 version of android in android studio,

  • Complete clean uninstall and reinstall of NetBeans, Android Studio, JDK, Android SDK as the Pc's Admin,

  • Using my colleague as a user,

  • Cleaning and building a simple start up projects,

  • Setting up identical NetBeans inputs as my colleagues',

  • Explored the depths of Google



I've checked out permissions and had a little look into Java Principals and Tools, but not 100% sure what I'm doing with that.

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

Answer

The plugin nbandroid is not compatible with NetBeans 8.2 based on the wiki stating its for NetBeans 8.1 nbandroid wiki and also a bug has been logged for the same issue on the nbandroid plugin site here.

Once they have updated the plugin to work with the newer version of NetBeans I would expect this to be resolved.