Android Compile issues in RSA 8.0.1 (Eclipse 3.6) - NoClassDefFoundError: sun/security/x509/X500Name

1.2k Views Asked by At

I installed the ADT plugin for eclipse smoothly. When I created my first Android project, right off the bat, I got the compile error below. I found that the sun/security/x509/X500Name is in the rt.jar so I tried adding that to my build path, but this causes the project to eat a lot of memory while compiling (I find this unusual). Has anyone been able to solve this issue? I'm using jdk1.6.0_24. I've seen other vague posts out there saying I need to use the Sun JDK. I'm already using that and I already have that in my JAVA_HOME. I'd appreciate any help you can provide. Thanks.

java.lang.NoClassDefFoundError: sun/security/x509/X500Name
    at com.android.sdklib.internal.build.SignedJarBuilder.writeSignatureBlock(Unknown Source)
    at com.android.sdklib.internal.build.SignedJarBuilder.close(Unknown Source)
    at com.android.sdklib.build.ApkBuilder.sealApk(Unknown Source)
    at com.android.ide.eclipse.adt.internal.build.BuildHelper.finalPackage(Unknown Source)
    at com.android.ide.eclipse.adt.internal.build.BuildHelper.finalDebugPackage(Unknown Source)
    at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(Unknown Source)
    at org.eclipse.core.internal.events.BuildManager$2.run(Unknown Source)
    at org.eclipse.core.runtime.SafeRunner.run(Unknown Source)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(Unknown Source)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(Unknown Source)
    at org.eclipse.core.internal.events.BuildManager$1.run(Unknown Source)
    at org.eclipse.core.runtime.SafeRunner.run(Unknown Source)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(Unknown Source)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(Unknown Source)
    at org.eclipse.core.internal.events.BuildManager.build(Unknown Source)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(Unknown Source)
    at org.eclipse.core.internal.events.AutoBuildJob.run(Unknown Source)
    at org.eclipse.core.internal.jobs.Worker.run(Unknown Source)
2

There are 2 best solutions below

0
On

I installed a stand-alone Eclipse 3.6 IDE (Helios) and it worked like a charm. Based on this, I've come to the conclusion that this will never work with IBM's RSA 8.0.1 (Even though it is based on Eclipse 3.6).

0
On

The not found class is used by SignedJarBuilder of the Android SDK. A solution could be not to use the signing of Android SDK, but to sign the created .apk separately, by the jarsigner command.

I did the signing using Maven - http://code.google.com/p/maven-android-plugin/wiki/SigningAPKWithMavenJarsigner.

You can specify the debug signing in the following way:

   <keystore>
    ${user.home}${file.separator}.android${file.separator}debug.keystore
   </keystore>
   <storepass>android</storepass>
   <keypass>android</keypass>
   <alias>androiddebugkey</alias>