Unable to run proguard on android_binary

131 views
Skip to first unread message

tjef...@google.com

unread,
Sep 17, 2015, 10:33:04 AM9/17/15
to bazel-discuss
I've successfully ported my Android app to bazel and I can get it build successfully. I'm now adding support for proguard, but the build now fails. I added

proguard_specs = ["proguard.txt"],

to my android_binary rule, but the tool cannot be run. Here's some sample output:

blaze build --verbose_failures :euchre_googleplay
INFO: Results are being streamed to http://cybertron:8088/result/456e3523-36f7-480c-b727-abd64825ba41
INFO: Found 1 target...
INFO: From Trimming binary with proguard:
Error: Unable to access jarfile external/androidsdk/tools/proguard/bin/../lib/proguard.jar
ERROR: /home/tcj/src/blaze_test/java/com/jeffreys/euchre/BUILD:3:1: Trimming binary with proguard failed: proguard.sh failed: error executing command
(cd /home/tcj/.cache/bazel/_bazel_tcj/86df34957ac88767728a08679bac58bf/blaze_test && \
exec env - \
external/androidsdk/tools/proguard/bin/proguard.sh -injars bazel-out/local_linux-fastbuild/bin/java/com/jeffreys/euchre/euchre_googleplay_deploy.jar -libraryjars external/androidsdk/platforms/android-21/android.jar -printmapping bazel-out/local_linux-fastbuild/bin/java/com/jeffreys/euchre/euchre_googleplay_proguard.map -outjars bazel-out/local_linux-fastbuild/bin/java/com/jeffreys/euchre/euchre_googleplay_proguard.jar @bazel-out/android-stub_armeabi-v7a-fastbuild/bin/java/android/validated_proguard/GooglePlayServices/java/android/proguard.txt_valid @bazel-out/android-stub_armeabi-v7a-fastbuild/bin/java/com/jeffreys/common/euchre/validated_proguard/euchre/java/com/jeffreys/common/euchre/proguard.txt_valid @bazel-out/local_linux-fastbuild/bin/java/com/jeffreys/euchre/proguard/euchre_googleplay/_euchre_googleplay_proguard.cfg @java/com/jeffreys/euchre/proguard.txt): proguard.sh failed: error executing command
(cd /home/tcj/.cache/bazel/_bazel_tcj/86df34957ac88767728a08679bac58bf/blaze_test && \
exec env - \
external/androidsdk/tools/proguard/bin/proguard.sh -injars bazel-out/local_linux-fastbuild/bin/java/com/jeffreys/euchre/euchre_googleplay_deploy.jar -libraryjars external/androidsdk/platforms/android-21/android.jar -printmapping bazel-out/local_linux-fastbuild/bin/java/com/jeffreys/euchre/euchre_googleplay_proguard.map -outjars bazel-out/local_linux-fastbuild/bin/java/com/jeffreys/euchre/euchre_googleplay_proguard.jar @bazel-out/android-stub_armeabi-v7a-fastbuild/bin/java/android/validated_proguard/GooglePlayServices/java/android/proguard.txt_valid @bazel-out/android-stub_armeabi-v7a-fastbuild/bin/java/com/jeffreys/common/euchre/validated_proguard/euchre/java/com/jeffreys/common/euchre/proguard.txt_valid @bazel-out/local_linux-fastbuild/bin/java/com/jeffreys/euchre/proguard/euchre_googleplay/_euchre_googleplay_proguard.cfg @java/com/jeffreys/euchre/proguard.txt).
Target //java/com/jeffreys/euchre:euchre_googleplay failed to build
INFO: Elapsed time: 0.195s, Critical Path: 0.07s


So the funny thing is, if I copy the command line starting with 'cd' and then executing proguard.sh, it works! It just doesn't seem to work from bazel build

Lukács T. Berki

unread,
Sep 18, 2015, 10:20:12 AM9/18/15
to Todd Jeffreys, bazel-discuss
I'll look into this on Monday (sorry, I had a busy day today)

Does this also happen if you add --execution_strategy=standalone to the Bazel command line?


--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/258dc769-d406-4310-892a-1a7a3c7145e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Lukács T. Berki | Software Engineer | lbe...@google.com | 

Google Germany GmbH | Dienerstrasse 12 | 80331 München | Germany | Geschäftsführer: Graham Law, Christine Elizabeth Flores | Registergericht und -nummer: Hamburg, HRB 86891

Lukács T. Berki

unread,
Sep 18, 2015, 10:20:41 AM9/18/15
to Todd Jeffreys, Philipp Wollermann, Alex Humesky, bazel-discuss
+Philipp, Alex in case one of them wants to investigate more

Todd Jeffreys

unread,
Sep 18, 2015, 1:10:07 PM9/18/15
to Lukács T. Berki, Philipp Wollermann, Alex Humesky, bazel-discuss
It worked when I used --spawn_strategy=standalone. I'm assuming sandboxed is preferred?

Philipp Wollermann

unread,
Sep 18, 2015, 1:26:05 PM9/18/15
to Todd Jeffreys, Lukács T. Berki, Alex Humesky, bazel-discuss
"Error: Unable to access jarfile external/androidsdk/tools/proguard/bin/../lib/proguard.jar"

Looks like it may be an undeclared input in the proguarding action - I guess doesn't list the JARs that make up proguard as inputs. If yes, this should be easy to fix. I'll check on Monday.
--
Google Germany GmbH
Dienerstraße 12
80331 München


Geschäftsführer: Graham Law, Christine Elizabeth Flores
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

Philipp Wollermann

unread,
Sep 21, 2015, 10:39:55 AM9/21/15
to Todd Jeffreys, Lukács T. Berki, Alex Humesky, bazel-discuss
Hi Todd,

thanks a lot for the report again! I could reproduce it & find the cause for this issue today and will prepare a fix for it tomorrow. I'll get back to you when it is reviewed & submitted. :)

Cheers,
Philipp
Reply all
Reply to author
Forward
0 new messages