可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I just installed Eclipse-Classic 3.7.2 and android SDK. Also installed/configured eclipse with ADT plugin.
Now after following the steps in http://developer.android.com/resources/tutorials/hello-world.html to create a "Hello World" application I tried to run the application in Android Emulator. But this is throwing an error
Errors occurred during the build. Errors running builder 'Android Package Builder' on project 'HelloAndroid'. sun/security/x509/X500Name
Can you please explain me what am I doing wrong here, or what do I need to fix for this error.
Thank you Zeeshan
回答1:
The problem is related with the JVM you are working with, but also the certificate that have to be generated with the keytool from this JVM.
Here you are the commands i have used to solve this problem in my Linux Ubuntu v11.04 system:
I have installed the Oracle/Sun SDK 1.6 ( SDK not the JRE one ) on my computer.
I made this new SUN JVM the default with the following instruction
sudo update-alternatives --config java
Note A list is shown with all the available JVM on your system, select the SUN one.
Now you will be able to execute this command with the JVM provided by SUN:
keytool -genkey -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android -keyalg RSA -validity 14000
Note You should delete the old debug.keystore file before you execute this command, or rename it as you wish.
Now that your system is up and running, then you need to configure your new JVM in Eclipse in order to compile with this new version.
回答2:
In my case, the ADT plugin was trying to use keytool utility present in JVM which launched eclipse. Which was IBM JDK, this failed as keytool which comes with IBM JDK is incompatible with the Sun version -- it has its a syntax that doesn't match the Google documentation, and it automatically creates the keystore file in ~/.keystore (without actually telling you where it was created).
Below solution worked for me:
1. Install sun jvm
2. From terminal execute: eclipse -vm path_to_sun_java/javaw
Instead of step 2, you can edit eclipse.ini to tell which jvm to use (ref eclipse.ini)
-vm /usr/lib/sunjdk/bin/javaw