This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 38693 - Call of mainDexClasses.bat does not produce records in multidex.keep
Summary: Call of mainDexClasses.bat does not produce records in multidex.keep
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild (show other bugs)
Version: unspecified
Hardware: PC Windows
: Low normal
Target Milestone: master
Assignee: dean.ellis
URL:
Depends on:
Blocks:
 
Reported: 2016-02-11 20:05 UTC by Mikhail Melnik
Modified: 2017-05-03 13:48 UTC (History)
3 users (show)

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


Attachments

Description Mikhail Melnik 2016-02-11 20:05:49 UTC
Some time ago I found that multidex option doesn't work as expected: https://forums.xamarin.com/discussion/57485/multiple-issues-with-library-project-and-multidex and shortly after that identified that root cause is a way how batch file parameters are sent and processed.

I assume it is working fine on OSX and *nix but on Windows there are two issues: on Xamarin side MSBuild generates an incorrect input parameter wrapping every path in unnecessary single quotes and on SDK side mainDexClasses.bat wraps some variables in unnecessary double quotes too.

Here is a part from original mainDexClasses.bat:

```
if DEFINED output goto redirect
call "%java_exe%" -Djava.ext.dirs="%frameworkdir%" com.android.multidex.MainDexListBuilder "%disableKeepAnnotated%" "%tmpJar%" "%params%"
goto afterClassReferenceListBuilder
:redirect
call "%java_exe%" -Djava.ext.dirs="%frameworkdir%" com.android.multidex.MainDexListBuilder "%disableKeepAnnotated%" "%tmpJar%" "%params%" 1>"%output%"
:afterClassReferenceListBuilder
```

and my workaround where I clean input and modify subsequent calls:

```
SET params=%params:'=%
if DEFINED output goto redirect
call "%java_exe%" -Djava.ext.dirs="%frameworkdir%" com.android.multidex.MainDexListBuilder %disableKeepAnnotated% "%tmpJar%" %params%
goto afterClassReferenceListBuilder
:redirect
call "%java_exe%" -Djava.ext.dirs="%frameworkdir%" com.android.multidex.MainDexListBuilder %disableKeepAnnotated% "%tmpJar%" %params% 1>"%output%"
:afterClassReferenceListBuilder
```
Comment 1 ian 2016-02-18 05:34:17 UTC
Great find. I reported this months ago and haven't really seen any progress on it, this is the first actual viable workaround I've seen.
Comment 2 dean.ellis 2017-04-26 13:09:47 UTC
a PR is up which should help address this issue [1].
It completely replaces the google tooling in this area.


[1] https://github.com/xamarin/xamarin-android/pull/575
Comment 3 dean.ellis 2017-05-03 13:48:04 UTC
Fixed in Xamarin-android/master/6829b7d1

We stopped using the .bat file in favour of making the calls ourselves.

Note You need to log in before you can comment on or make changes to this bug.