processing-android icon indicating copy to clipboard operation
processing-android copied to clipboard

Cannot run program "keytool"

Open nclavaud opened this issue 9 years ago • 5 comments

I'm running Processing 3.2.1 on Ubuntu 16.04.1 and I have installed Android mode 3.0.1 using the Contribution Manager. I have been prompted to install the Android SDK and I end up with Android SDK 6.0 (23) installed.

When trying to run the Getting started tutorial app on my device, I get the build error below, complaining file java/bin/keytool cannot be found.

BUILD FAILED
/home/processing/sketchbook/modes/AndroidMode/sdk/tools/ant/build.xml:958: The following error occurred while executing this line:
/home/processing/sketchbook/modes/AndroidMode/sdk/tools/ant/build.xml:969: The following error occurred while executing this line:
/home/processing/sketchbook/modes/AndroidMode/sdk/tools/ant/build.xml:312: com.android.sdklib.build.ApkCreationException: Failed to create key: Cannot run program "/home/processing/processing-3.2.1/java/bin/keytool": error=2, No such file or directory
JAVA_HOME is set to: /home/processing/processing-3.2.1/java
Update it if necessary, or manually execute the following command:
/home/processing/processing-3.2.1/java/bin/keytool -genkey -alias AndroidDebugKey -keyalg RSA -dname "CN=Android Debug,O=Android,C=US" -validity 10950 -keypass android -keystore /home/processing/.android/debug.keystore -storepass android
    at com.android.sdklib.build.ApkBuilder.getDebugKey(ApkBuilder.java:300)
    ...
    at processing.mode.android.AndroidEditor$16.run(AndroidEditor.java:553)

Indeed the file does not exist on my machine.

Did I miss something?

nclavaud avatar Oct 09 '16 19:10 nclavaud

Actually the keytool executable is available at /usr/bin/keytool on my machine.

$ whereis keytool
keytool: /usr/bin/keytool /usr/share/man/man1/keytool.1.gz

I could alias it, and managed to build the example application succesfully.

$ ln -s /usr/bin/keytool /home/processing/processing-3.2.1/java/bin/keytool

This step is not documented. Should we document it in Getting started tutorial?

nclavaud avatar Oct 10 '16 07:10 nclavaud

@nclavaud thanks for your report, and the workaround. The mode should not try to run a missing keytool binary though. Will look into it!

codeanticode avatar Oct 12 '16 21:10 codeanticode

I have experienced this on Ubuntu 16.04 as well. I had to install the java SDK though to get access to the key tool and perform the above workaround.

pierrep avatar Oct 16 '16 09:10 pierrep

actually we have the same issue with linux mint 18 64 bits, and where can i'm gona donate for processing for android

chepecarlos avatar Nov 05 '16 07:11 chepecarlos

Looks like this is due to an omission in Processing's build file, which is removing keytool on Windows and Linux https://github.com/processing/processing/issues/3288

codeanticode avatar Dec 29 '16 23:12 codeanticode