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

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

我想知道是否有人可以在这方面提供帮助。清理和构建最简单的项目时会发生错误。 (见下文)

导致错误的步骤:

作为一名新员工,因此我是使用不超过 4 个月的机器的新用户,我首先打开 NetBeans 8.2 - 一周前为我安装了 NetBeans 和 Android Studio(用于 sdk) .

但是没有安装Android插件,所以我实现了nbandroid更新中心来安装插件。然后,我将在 users\user.user1\AppData\local\android 文件夹中找到的 sdk 连接到 NetBeans。

为了运行某个项目的正确Android版本(4.2.2),我先在AndroidStudio/SDK安装了版本4及以上经理,在NetBeans中选择4.2.2之前。

在 NetBeans 中打开本地版本之前,我继续将 android 项目从共享文件服务器复制到我的本地计算机。

执行 Clean & Build 后出现以下错误(您可能会注意到有些文件夹结构与上述不同。这是由于测试了不同的配置以找到可能的解决方案):

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.run(X500Name.java:1384)
                at sun.security.x509.X500Name.run(X500Name.java:1380)

这真的很奇怪,因为我的同事在他的 PC 上编译没有问题(几乎相同的 PC,除了 NetBeans 8.1 和 Jdk8u91 而不是我最新的 java)

已经咨询过的方案:

我检查了权限并略微研究了 Java 主体和工具,但不能 100% 确定我在用它做什么。

我想在尝试其他任何事情之前先咨询堆栈。感谢任何帮助。

同意@RandykaYudhistira 在评论中的意见,采取了降级到 8.1 的解决方案,这完全解决了问题 - 允许我清理和构建新的本地应用程序。

成功。

但是,这并不能解决 NetBeans 8.2 的问题。找出这个问题是否有解决方案,以及为什么像我和其他人这样的设置会遇到这个问题,这将是一件很有趣的事情。

欢迎任何其他解决方案 - 解决而不是 'work around' 我在这里。

插件 nandroid 与 NetBeans 8.2 不兼容,基于 wiki 说明它适用于 NetBeans 8.1 nbandroid wiki and also a bug has been logged for the same issue on the nbandroid plugin site here

一旦他们更新插件以使用较新版本的 NetBeans,我希望这个问题能够得到解决。