Skip to content

Encountering new path escaping issues when using multidex/proguard on Windows #1135

@pjcollins

Description

@pjcollins

I'm encountering new path escaping issues on Windows due when using proguard and/or multidex in certain projects. I see a recent and seemingly related change in this area in this commit 2c2d47c.

Steps to Reproduce

  1. Attempt to build a project with multidex and or proguard enabled.
  2. msbuild /t:SignAndroidPackage KitKat.csproj /p:Configuration=Release /p:AndroidEnableProguard=true
    https://github.com/xamarin/monodroid-samples/tree/master/KitKat

Expected Behavior

Proguard and multidex tool invocations succeed without issue on Windows.

Actual Behavior

Various path escaping issues are preventing proguard and multidex from executing successfully:

 Environment Variables passed to tool: (TaskId:339)
    PROGUARD_HOME=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\proguard (TaskId:339)
    JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8 (TaskId:339)
  C:\Program Files\Java\jdk1.8.0_144\\bin\java.exe -jar "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\proguard\lib\proguard.jar" -include "C:\Program Files (x86)\Android\android-sdk\\tools\proguard\proguard-android.txt" -include "obj\Release\proguard\proguard_xamarin.cfg" -include "obj\Release\proguard\proguard_project_references.cfg" -include "obj\Release\proguard\proguard_project_primary.cfg" -injars "obj\Release\android\bin\classes\classes.zip(!META-INF/MANIFEST.MF)";"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v8.0\mono.android.jar(!META-INF/MANIFEST.MF)" -libraryjars "C:\Program Files (x86)\Android\android-sdk\platforms\android-26\android.jar" -outjars obj\Release\proguard\__proguard_output__.jar -optimizations !code/allocation/variable  (TaskId:339)
PROGUARD : error : C:\Program Files (Access is denied) [C:\xqatmp\b1b545ee\KitKat\KitKat.csproj]
  Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8 (TaskId:339)
  The command exited with code 1. (TaskId:339)
Done executing task "Proguard" -- FAILED. (TaskId:339)
ToolPath: C:\Program Files\Java\jdk1.8.0_144\\bin (TaskId:1130)
    ProguardJarPath: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\proguard\lib\proguard.jar (TaskId:1130)
    ProguardInputJarFilter: (!META-INF/MANIFEST.MF) (TaskId:1130)
  C:\Program Files\Java\jdk1.8.0_144\\bin\java.exe -jar "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\proguard\lib\proguard.jar" -injars "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v7.1\mono.android.jar(!META-INF/MANIFEST.MF)";"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\android-support-multidex.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\0\jl\formsviewgroup.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\10\jl\bin\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\11\jl\bin\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\12\jl\bin\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\13\jl\bin\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\14\jl\bin\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\15\jl\bin\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\16\jl\bin\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\17\jl\bin\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\18\jl\bin\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\19\jl\bin\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\20\jl\bin\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\21\jl\bin\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\27\jl\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\28\jl\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\29\jl\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\30\jl\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\31\jl\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\32\jl\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\33\jl\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\34\jl\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\35\jl\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\36\jl\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\37\jl\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\38\jl\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\6\jl\bin\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\8\jl\bin\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\lp\9\jl\bin\classes.jar(!META-INF/MANIFEST.MF)";"obj\Debug\android\bin\classes\classes.zip(!META-INF/MANIFEST.MF)" -dontwarn -forceprocessing -outjars C:\agent\_work\_temp\h24rcf4d.bej.jar -libraryjars "\"C:\Program Files (x86)\Android\android-sdk\build-tools\26.0.2\lib\shrinkedAndroid.jar\"" -dontoptimize -dontobfuscate -dontpreverify -include "C:\Program Files (x86)\Android\android-sdk\build-tools\26.0.2\mainDexClasses.rules"  (TaskId:1130)
CREATEMULTIDEXMAINDEXCLASSLIST : error : Expecting class path separator ';' before '\Microsoft' in argument number 2 [C:\xqatmp\Bug15162\Bug15162\Bug15162.csproj]
  The command exited with code 1. (TaskId:1130)
Done executing task "CreateMultiDexMainDexClassList" -- FAILED. (TaskId:1130)

Version Information

XA 8.0.0.2 (d15-6)

Log File

http://xqa.blob.core.windows.net/gist/log-7c8201b17c434ec9bee20eac7ddb8f93.txt
http://xqa.blob.core.windows.net/gist/log-33e409f0ca854d3c93c92f4a9849df57.txt

Metadata

Metadata

Labels

bugComponent does not function as intended.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions