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

clean suceeded, build failed #25261

Closed
vsfeedback opened this issue Oct 14, 2024 · 10 comments
Closed

clean suceeded, build failed #25261

vsfeedback opened this issue Oct 14, 2024 · 10 comments
Labels
partner/android Issues for the Android SDK
Milestone

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


[severity:I'm unable to use this version] [regression] [worked-in:vs2022]
1>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:28)
1>MSBUILD : java.exe error JAVA0000: ... 6 more
1>MSBUILD : java.exe error JAVA0000:
1>Done building project "Zl1800phone.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 8:02 PM and took 01:01.102 minutes ==========


Original Comments

joepuhich2 on 8/14/2024, 08:06 PM:

everything else seems to work fine. .net maui c# android project. the project compiles all programs , bur does not build!!

joepuhich2 on 8/14/2024, 08:10 PM:

1>MSBUILD : java.exe error JAVA0000:
1>Done building project “Zl1800phone.csproj” – FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 5:30 PM and took 09.670 seconds ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
========== Deploy completed at 5:30 PM and took 09.670 seconds ==========
Copilot
Sent by Copilot:
It looks like you’re encountering the MSBUILD : java.exe error JAVA0000 during your .NET for Android build. Let’s troubleshoot this issue:

Multiple Definitions Error: The error message indicates that a type (android.support.v4.app.INotificationSideChannel$Stub) is defined multiple times. This can happen when there are conflicting dependencies or duplicate classes in your project.
Possible Solutions:
Check Dependencies: Ensure that you don’t have conflicting dependencies in your project. Make sure you’re using compatible versions of libraries.
Clean and Rebuild: Sometimes, cleaning your project and rebuilding it can resolve issues related to duplicate classes.
Check Stack Trace: Look at the stack trace included in the error message. It might provide additional clues about the root cause.
Submit a Bug: If this error occurs under normal circumstances, consider submitting a bug report to the relevant tool or library.
Additional Tips:
If you’re using .NET MAUI, ensure that you’ve added Xamarin.AndroidX.Fragment.Ktx and Xamarin.GooglePlayServices.Base in your project’s configuration for Android 8.0 (net8.0-android) 1.
You can also try enabling MultiDex if other solutions don’t work 2.

Feedback Bot on 8/14/2024, 10:43 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

YanFang Wang (CSI Interfusion Inc) [MSFT] on 8/15/2024, 04:23 AM:

Thanks for taking time to report the issue.
From your description, you are building .net maui c# android project, I would like to know is your project a newly created default MAUI template project or a project developed based on your own MAUI template?
JAVA0000 is a generic error code for every Java error. You’ll need to look at the build log to see the actual message reported from javac.
And for us to investigate this further, could you provide Xamarin Log and Binlog?
Xamarin Log: (Help->Xamarin->Zip Log…)
Binlog:
1.Change the build output verbosity to “Diagnostic” from Tools -> Options -> Projects and Solutions -> Build and Run -> MS Build project build output verbosity
2.Install the Project System Tools (https://marketplace.visualstudio.com/items?itemName=VisualStudioProductTeam.ProjectSystemTools2022) extension
3. In Visual Studio, choose the View > Other Windows > Build Logging menu item.
4.Select the “Builds” option in the dropdown list of the Build Logging tool window
5.Click on the “play” button.
6.Reproduce the issue
7.Select all entries in the build logging tool window
8.Right-click them, Save Logs
9.Attach the resulting zip file to this issue.
You can inspect the logs too by installing the msbuildlog viewer tool (https://msbuildlog.com/).
Alternatively, provide a sample project that reproduces the error will be better for us investigate the issue.

joepuhich2 on 8/15/2024, 07:25 AM:

(private comment, text removed)

joepuhich2 on 8/15/2024, 07:07 AM:

(private comment, text removed)

joepuhich2 on 8/15/2024, 07:28 AM:

(private comment, text removed)

YanFang Wang (CSI Interfusion Inc) [MSFT] on 8/15/2024, 11:39 PM:

Thanks for your replay message, yes, you have upload binlog successfully.
This feedback is being re-triaged as we are moving it to another team that can better help with the issue. Thanks for your patience.

joepuhich2 on 8/23/2024, 01:58 PM:

(private comment, text removed)

joepuhich2 on 9/3/2024, 03:30 PM:

(private comment, text removed)

joe puhich on 9/17/2024, 04:01 PM:

1>MSBUILD : java.exe error JAVA0000: Type androidx.activity.ActivityViewModelLazyKt$viewModels$1 is defined multiple times: obj\Debug\net8.0-android34.0\lp\136\jl\classes.jar:androidx/activity/ActivityViewModelLazyKt$viewModels$1.class, obj\Debug\net8.0-android34.0\lp\178\jl\classes.jar:androidx/activity/ActivityViewModelLazyKt$viewModels$1.class
i found these jar files that are multiples??? how do i remove the duplicate file and still maintain the project build??
I used dotnet list program to find the duplicate files. There were not duplicate files in the project directory. I do not know how to find the multiple files. Everything else seems to be working correctly.

joe puhich on 9/30/2024, 08:31 AM:

1>MSBUILD : java.exe error JAVA0000: Error in obj\Debug\net8.0-android34.0\lp\136\jl\classes.jar:androidx/activity/ActivityViewModelLazyKt$viewModels$1.class:
1>MSBUILD : java.exe error JAVA0000: Type androidx.activity.ActivityViewModelLazyKt$viewModels$1 is defined multiple times: obj\Debug\net8.0-android34.0\lp\136\jl\classes.jar:androidx/activity/ActivityViewModelLazyKt$viewModels$1.class, obj\Debug\net8.0-android34.0\lp\178\jl\classes.jar:androidx/activity/ActivityViewModelLazyKt$viewModels$1.class
I pluged my android phone in and i get this error. what could be wrong???

joe puhich on 10/1/2024, 04:44 PM:

(private comment, text removed)

joe puhich on 10/4/2024, 08:27 PM:

(private comment, text removed)

joe puhich on 10/6/2024, 05:20 AM:

(private comment, text removed)

joe puhich on 10/6/2024, 06:14 AM:

(private comment, text removed)

joe puhich on 10/8/2024, 10:16 PM:

(private comment, text removed)

joe puhich on 10/10/2024, 11:47 AM:

(private comment, text removed)

@samhouts
Copy link
Member

See #20561. @moljac

@samhouts samhouts added the t/bug Something isn't working label Oct 14, 2024
@samhouts
Copy link
Member

Essentially, MAUI has transitive dependencies on AndroidX, and a third-party package has dependencies on different versions of those AndroidX packages. Until MAUI updates to match the third party, there's these errors. This is a really frustrating scenario, and very difficult to workaround!

@PureWeen
Copy link
Member

@jonpryor @jonathanpeppers

@jonathanpeppers
Copy link
Member

The issue here discusses how to troubleshoot java.exe error JAVA0000: Type androidx.activity.ActivityViewModelLazyKt$viewModels$1 is defined multiple times:

Can you follow the steps listed on the above issue?

@jonathanpeppers jonathanpeppers added the s/needs-info Issue needs more info from the author label Oct 14, 2024
Copy link
Contributor

Hi @vsfeedback. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@moljac
Copy link
Contributor

moljac commented Oct 15, 2024

There is sticky issue in AndroidX repo with collection of similar errors, mso users can get feeling how to solve this issue.

dotnet/android-libraries#764

The solution is to find packages that cause the problem and update them to latest/newest (mimic Maven version resolution).

Essentially, MAUI has transitive dependencies on AndroidX, and a third-party package has dependencies on different versions of those AndroidX packages.

This is common problem in real world applications and we cannot do too much, but ask users to require frequent updates of 3rd party dependencies to latest packages. The problem is different version resolution strategies in NuGet and Maven.

Until MAUI updates to match the third party, there's these errors. This is a really frustrating scenario, and very difficult to workaround!

... or 3rd party matches transitive versions of MAUI. From real world experience in most cases MAUI versions are newer than 3rd party, but that might vary in other cases.

@moljac
Copy link
Contributor

moljac commented Oct 15, 2024

After reading a bit deeper...

Seems like user is using Android Support libraries which are deprecated for years!!

from

https://developercommunity.visualstudio.com/t/clean-suceeded-build-failed/10723102#T-N10761507

1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.138\tools\Xamarin.Android.Common.targets(516,3): warning XA1039: The Android Support libraries are not supported in .NET 9 and later, please migrate to AndroidX. See https://aka.ms/net-android/androidx for more details.

@moljac
Copy link
Contributor

moljac commented Oct 15, 2024

It would be good if user could provide list of PackageRererences used in a project.

@jonathanpeppers
Copy link
Member

If Android.Support is indeed being used, it is not "supported".

We emit a warning in .NET 8, which becomes an error in .NET 9:

@jonathanpeppers
Copy link
Member

The .binlog on the above DevCom issue has:

Image

The obj\project.assets.json file would show which package has a dependency on these. I would recommend removing it, thanks!

@github-actions github-actions bot locked and limited conversation to collaborators Nov 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
partner/android Issues for the Android SDK
Projects
None yet
Development

No branches or pull requests

5 participants