Bug 40372 - dx.jar --output should specify a *file*, not a directory.
Summary: dx.jar --output should specify a *file*, not a directory.
Status: RESOLVED ANSWERED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 6.0.99
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: dean.ellis
URL:
Depends on:
Blocks:
 
Reported: 2016-04-14 01:03 UTC by Jonathan Pryor
Modified: 2017-06-28 10:59 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
build tools build logs (23.96 KB, application/zip)
2016-04-14 16:43 UTC, Peter Collins
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Jonathan Pryor 2016-04-14 01:03:51 UTC
When building, the <CompileToDalvik/> task invokes the Android SDK dx.jar utility and specifies an output *directory*:

>                                 Tool /usr/bin/java execution started with arguments: -jar /opt/android/sdk-tool/sdk/build-tools/23.0.0//lib/dx.jar --no-strict --dex --output=obj/Debug/android/bin obj/Debug/android/bin/classes /Users/jon/Development/xamarin/monodroid/out/lib/xbuild-frameworks/MonoAndroid/v2.3/mono.android.jar 

Note: --output=obj/Debug/android/bin

Meanwhile, dx.jar appears to state that it wants a *file*:

> java -jar $ANDROID_SDK_PATH/platforms/android-4/tools/lib/dx.jar -help
> ...
>   [--keep-classes] [--output=<file>] [--dump-to=<file>] [--dump-width=<n>]

Files are not directories.

It seems that on certain versions of dx.jar, this causes the build to fail:

> Tool exited with code: 1. Output: unknown output extension: obj/Debug/android/bin
> usage:
>   dx --dex [--debug] [--verbose] [--positions=<style>] [--no-locals]
>   [--no-optimize] [--statistics] [--[no-]optimize-list=<file>] [--no-strict]
Comment 2 Jonathan Pryor 2016-04-14 01:05:06 UTC
@PeterC: Could we figure out which versions of dx.jar work and which versions fail?

I fear that all new Xamarin.Android installations will fail due to this apparent change in dx.jar behavior.
Comment 4 dean.ellis 2016-04-14 14:16:56 UTC
looks at eno's comments it looks like Kumpera just needs to upgrade his build-tools to something less ancient
Comment 5 Peter Collins 2016-04-14 16:43:01 UTC
Created attachment 15725 [details]
build tools build logs

I tested all build-tools versions available in the SDK manager (as of 2016-04-14) and was unable to reproduce this error with any of them. The versions tested were:
> 24 rc3
> 23.0.3
> 23.0.2
> 23.0.1
> 22.0.1
> 21.1.2
> 20
> 19.1

I think it's safe to resolve this.