Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand Java directory mapping message to support multiple directories #9089

Closed
jpobst opened this issue Jul 8, 2024 · 0 comments · Fixed by #9121
Closed

Expand Java directory mapping message to support multiple directories #9089

jpobst opened this issue Jul 8, 2024 · 0 comments · Fixed by #9121
Assignees
Labels
Area: App+Library Build Issues when building Library projects or Application projects. enhancement Proposed change to current functionality.
Milestone

Comments

@jpobst
Copy link
Contributor

jpobst commented Jul 8, 2024

Context: xamarin/GooglePlayServicesComponents#885 (comment)

When we get a Type <javatype> is defined multiple times error like:

MSBUILD : java error JAVA0000: Error in obj/Debug/net8.0-android/lp/548/jl/classes.jar:com/google/protobuf/DescriptorProtos$1.class: [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: Type com.google.protobuf.DescriptorProtos$1 is defined multiple times: obj/Debug/net8.0-android/lp/548/jl/classes.jar:com/google/protobuf/DescriptorProtos$1.class, obj/Debug/net8.0-android/lp/405/jl/libs/8E428AF64A795598.jar:com/google/protobuf/DescriptorProtos$1.class [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: Compilation failed [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj/Debug/net8.0-android/lp/548/jl/classes.jar [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: com/google/protobuf/DescriptorProtos$1.class [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:135) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at com.android.tools.r8.D8.main(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:5) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj/Debug/net8.0-android/lp/548/jl/classes.jar:com/google/protobuf/DescriptorProtos$1.class [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at Version.fakeStackEntry(Version_8.2.33.java:0) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at com.android.tools.r8.T.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:5) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:82) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:32) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:31) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at com.android.tools.r8.utils.S0.b(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:2) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:42) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at com.android.tools.r8.D8.b(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:13) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:40) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:122) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	... 1 more [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: Caused by: com.android.tools.r8.utils.b: Type com.google.protobuf.DescriptorProtos$1 is defined multiple times: obj/Debug/net8.0-android/lp/548/jl/classes.jar:com/google/protobuf/DescriptorProtos$1.class, obj/Debug/net8.0-android/lp/405/jl/libs/8E428AF64A795598.jar:com/google/protobuf/DescriptorProtos$1.class [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at com.android.tools.r8.utils.Q2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:21) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:54) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:10) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2048) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:6) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at com.android.tools.r8.graph.m4$a.d(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:6) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:61) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:12) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:9) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:45) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at com.android.tools.r8.D8.d(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:17) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at com.android.tools.r8.D8.c(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:69) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:28) [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: 	... 6 more [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
MSBUILD : java error JAVA0000: Directory 'obj/Debug/net8.0-android/lp/548' is from 'protolitewellknowntypes-18.0.0.aar'. [./samples/dotnet/BuildAllDotNet/BuildAllDotNet.csproj::TargetFramework=net8.0-android]
    15 Warning(s)
    1 Error(s)

The core error is:

Type com.google.protobuf.DescriptorProtos$1 is defined multiple times: 
  obj/Debug/net8.0-android/lp/548/jl/classes.jar:com/google/protobuf/DescriptorProtos$1.class, 
  obj/Debug/net8.0-android/lp/405/jl/libs/8E428AF64A795598.jar:com/google/protobuf/DescriptorProtos$1.class

Our tooling helpfully gives us this additional message:

Directory 'obj/Debug/net8.0-android/lp/548' is from 'protolitewellknowntypes-18.0.0.aar'.

However it only ever gives that message for a single directory. It would be nice to get that message for all listed directories to help give users the information they need to solve the issue.

@jpobst jpobst added the Area: App+Library Build Issues when building Library projects or Application projects. label Jul 8, 2024
@jpobst jpobst added this to the .NET 9 milestone Jul 8, 2024
@dotnet-policy-service dotnet-policy-service bot added the needs-triage Issues that need to be assigned. label Jul 8, 2024
@jpobst jpobst added enhancement Proposed change to current functionality. and removed needs-triage Issues that need to be assigned. labels Jul 8, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Aug 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: App+Library Build Issues when building Library projects or Application projects. enhancement Proposed change to current functionality.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants