Skip to content

Conversation

@jonpryor
Copy link
Contributor

Context: dotnet/android-tools#156

Changes: jonpryor/xamarin-android-tools@0e80ea1...9768b42

@jonpryor
Copy link
Contributor Author

Unit tests are failing when dx is used, e.g. Xamarin.Android.Build.Tests.BuildTest.BuildApplicationWithSpacesInPath(True,"dx","proguard"):

Task "CreateMultiDexMainDexClassList" (TaskId:178)
  Task Parameter:ToolPath=/Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.14-101/x64/Contents/Home/bin (TaskId:178)
  Task Parameter:
      JavaLibraries=
          /Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v12.1/mono.android.jar
          /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/java_runtime.jar
          Hello (World).jar
          /Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/android-support-multidex.jar (TaskId:178)
  Task Parameter:ClassesOutputDirectory=obj/Release/android/bin/classes/ (TaskId:178)
  Task Parameter:ProguardInputJarFilter=(!META-INF/MANIFEST.MF) (TaskId:178)
  Task Parameter:MultiDexMainDexListFile=obj/Release/multidex.keep (TaskId:178)
  Task Parameter:AndroidSdkBuildToolsPath=/Users/runner/Library/Android/sdk/build-tools/32.0.0/ (TaskId:178)
  Task Parameter:ProguardJarPath=/Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/proguard/lib/proguard.jar (TaskId:178)
  /Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.14-101/x64/Contents/Home/bin/java -jar /Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/proguard/lib/proguard.jar -injars "'/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v12.1/mono.android.jar'(!META-INF/MANIFEST.MF):'/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/java_runtime.jar'(!META-INF/MANIFEST.MF):'Hello (World).jar'(!META-INF/MANIFEST.MF):'/Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/android-support-multidex.jar'(!META-INF/MANIFEST.MF):'obj/Release/android/bin/classes/../classes.zip'(!META-INF/MANIFEST.MF)" -dontwarn -forceprocessing -outjars /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/4hs8jt4l.fjl.jar -libraryjars "'/Users/runner/Library/Android/sdk/build-tools/32.0.0/lib/shrinkedAndroid.jar'" -dontoptimize -dontobfuscate -dontpreverify -include '/Users/runner/Library/Android/sdk/build-tools/32.0.0/mainDexClasses.rules'  (TaskId:178)
  ProGuard, version 7.0.1 (TaskId:178)
  Reading program jar [/Library/Frameworks/Xamarin.Android.framework/Versions/12.2.99.111/lib/xamarin.android/xbuild-frameworks/MonoAndroid/v12.1/mono.android.jar] (filtered) (TaskId:178)
  Reading program jar [/Library/Frameworks/Xamarin.Android.framework/Versions/12.2.99.111/lib/xamarin.android/xbuild/Xamarin/Android/java_runtime.jar] (filtered) (TaskId:178)
  Reading program jar [/Users/runner/work/1/a/TestRelease/02-17_01.45.19/temp/BuildReleaseApp AndÜmläüts(Truedxproguard)/Hello (World).jar] (filtered) (TaskId:178)
  Reading program jar [/Library/Frameworks/Xamarin.Android.framework/Versions/12.2.99.111/lib/xamarin.android/xbuild/Xamarin/Android/android-support-multidex.jar] (filtered) (TaskId:178)
  Reading program zip [/Users/runner/work/1/a/TestRelease/02-17_01.45.19/temp/BuildReleaseApp AndÜmläüts(Truedxproguard)/obj/Release/android/bin/classes.zip] (filtered) (TaskId:178)
  Reading library jar [/Users/runner/Library/Android/sdk/build-tools/32.0.0/lib/shrinkedAndroid.jar] (filtered) (TaskId:178)
  Note: android.support.multidex.MultiDexExtractor accesses a method 'apply()' dynamically (TaskId:178)
  Note: mono.android.incrementaldeployment.IncrementalClassLoader accesses a declared field 'parent' dynamically (TaskId:178)
  Note: there were 2 accesses to class members by means of reflection. (TaskId:178)
        You should consider explicitly keeping the mentioned class members (TaskId:178)
        (using '-keep' or '-keepclassmembers'). (TaskId:178)
        (https://www.guardsquare.com/proguard/manual/troubleshooting#dynamicalclassmember) (TaskId:178)
  Note: you're ignoring all warnings! (TaskId:178)
  Preparing output jar [/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/4hs8jt4l.fjl.jar] (filtered) (TaskId:178)
    Copying resources from program jar [/Library/Frameworks/Xamarin.Android.framework/Versions/12.2.99.111/lib/xamarin.android/xbuild-frameworks/MonoAndroid/v12.1/mono.android.jar] (filtered) (TaskId:178)
    Copying resources from program jar [/Library/Frameworks/Xamarin.Android.framework/Versions/12.2.99.111/lib/xamarin.android/xbuild/Xamarin/Android/java_runtime.jar] (filtered) (TaskId:178)
    Copying resources from program jar [/Users/runner/work/1/a/TestRelease/02-17_01.45.19/temp/BuildReleaseApp AndÜmläüts(Truedxproguard)/Hello (World).jar] (filtered) (TaskId:178)
    Copying resources from program jar [/Library/Frameworks/Xamarin.Android.framework/Versions/12.2.99.111/lib/xamarin.android/xbuild/Xamarin/Android/android-support-multidex.jar] (filtered) (TaskId:178)
    Copying resources from program zip [/Users/runner/work/1/a/TestRelease/02-17_01.45.19/temp/BuildReleaseApp AndÜmläüts(Truedxproguard)/obj/Release/android/bin/classes.zip] (filtered) (TaskId:178)
  /Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.14-101/x64/Contents/Home/bin/java -classpath "/Users/runner/Library/Android/sdk/build-tools/32.0.0/lib/d8.jar:/Users/runner/Library/Android/sdk/build-tools/32.0.0/lib/shrinkedAndroid.jar:/Users/runner/Library/Android/sdk/build-tools/32.0.0/lib/apksigner.jar" com.android.multidex.MainDexListBuilder /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/4hs8jt4l.fjl.jar '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v12.1/mono.android.jar':'/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/java_runtime.jar':'Hello (World).jar':'/Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/android-support-multidex.jar':'obj/Release/android/bin/classes/../classes.zip'  (TaskId:178)
CREATEMULTIDEXMAINDEXCLASSLIST : error : Could not find or load main class com.android.multidex.MainDexListBuilder [/Users/runner/work/1/a/TestRelease/02-17_01.45.19/temp/BuildReleaseApp AndÜmläüts(Truedxproguard)/UnnamedProject.csproj]
  Caused by: java.lang.ClassNotFoundException: com.android.multidex.MainDexListBuilder (TaskId:178)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.DX.targets(62,5): error : java.lang.ClassNotFoundException :  com.android.multidex.MainDexListBuilder [/Users/runner/work/1/a/TestRelease/02-17_01.45.19/temp/BuildReleaseApp AndÜmläüts(Truedxproguard)/UnnamedProject.csproj]
Done executing task "CreateMultiDexMainDexClassList" -- FAILED. (TaskId:178)

This is caused by $(AndroidSdkBuildToolsVersion) changing from 30.0.3 -- which contains com.android.multidex.MainDexListBuilder -- to 32.0.0, which does not:

% jar tf ~/android-toolchain/sdk/build-tools/30.0.3/lib/dx.jar | grep com.android.multidex.MainDexListBuilder
com/android/multidex/MainDexListBuilder.class

Build-tools 32.0.0 does not contain dx.jar; this seems relevant: https://android-developers.googleblog.com/2020/02/the-path-to-dx-deprecation.html

On Feb 1st, 2021, we’ll move to step 3, removing DX fully from Android Studio and any other build environments.

@dellis1972, @jonathanpeppers: what should we do here? Should we keep $(AndroidSdkBuildToolsVersion) at 30.0.3 for .net 6 & Visual Studio 17.2, and bump it for .net 7? Something else?

@dellis1972
Copy link
Contributor

I'm not sure we can just stop shipping dx unless we've told the users to stop using it. I can't remember if we have or not.

If we have then we can problem drop it and all the tests.

Changes: jonpryor/xamarin-android-tools@0e80ea1...bbe85df

  * dotnet/android-tools@bbe85df4: [Xamarin.Android.Tools.AndroidSdk] Update SDK component for API-32
  * dotnet/android-tools@a7f4d30: [ci] Mention new NuGet feed and release (dotnet#153)
  * dotnet/android-tools@85ae77f: Merge pull request dotnet#152 from xamarin/dev/mattnorflus/SigningMigration
  * dotnet/android-tools@dd34e54: Adding condition to GetFilesToSign to only include files if build configuration is Release
@jonpryor jonpryor marked this pull request as ready for review February 18, 2022 17:16
@jonpryor
Copy link
Contributor Author

@dellis1972 asked:

I'm not sure we can just stop shipping dx unless we've told the users to stop using it.

We have been emitting an XA1023 warning for quite some time, and it's been an error under .NET 6.

I currently think that the Xamarin.Android 12.3 release should continue to support dx.

@jonpryor jonpryor merged commit d73e048 into dotnet:main Feb 18, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants