Repository navigation
Java source file set build-action "AndoidJavaSource" in project causes compile error #8698
Description
Activity
- addedneeds-triageIssues that need to be assigned.Issues that need to be assigned.
on Feb 2, 2024 - addedArea: App+Library BuildIssues when building Library projects or Application projects.Issues when building Library projects or Application projects.and removedneeds-triageIssues that need to be assigned.Issues that need to be assigned.
on Feb 2, 2024 This is the bug?
Is interoperability between C# and Java impossible at the source code level?Do you have a sample which demonstrates the issue?
- addedneed-infoIssues that need more information from the author.Issues that need more information from the author.
on Feb 8, 2024 - addedneed-attentionA xamarin-android contributor needs to reviewA xamarin-android contributor needs to reviewand removedneed-infoIssues that need more information from the author.Issues that need more information from the author.
on Feb 8, 2024 Do you have a sample which demonstrates the issue?
This is the sample to reproduce.
AndroidApp2.zip

I suspect you are hitting the same issue as #8658.
Can you try adding the following to the first PropertyGroup in your csproj.
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
See if that helps. Alternatively in Visual Studio goto
Tools | Options | Projects and Solutions | SDK-Style Projects
and disable the "Up to Date Checks".
- removedneed-attentionA xamarin-android contributor needs to reviewA xamarin-android contributor needs to review
on Feb 9, 2024 When I tried it, a compile error occurred, but I was able to deploy it.
However, this option prevents to detect the change code with "build". After all, I have to "rebuild" and compile all the code every time to deploy.
Is this spec?ok, so its Intellisense which is not working.
yes, Intellisense is not working at all, even if *.cs exists in object/.../generated folder or not.
And the generated *.cs files are disappeared when build after rebuild even if DisableFastUpToDateCheck is true or not.yes, Intellisense is not working at all, even if *.cs exists in object/.../generated folder or not. And the generated *.cs files are disappeared when build after rebuild even if DisableFastUpToDateCheck is true or not.
One of our targets is not running during the Intellisense build. I thought we had fixed that.....
It looks like theInstalltarget is deleting the .cs files, I'm going to be looking at that next week.Has there been any progress about this issue?
This PR is working on the issue #8706
Thank you for the information.
- added a commit that references this issue
on Mar 25, 2024 - added a commit that references this issue
on Mar 26, 2024 - locked and limited conversation to collaborators
on Apr 26, 2024
This issue has been moved from a ticket on Developer Community.
[regression]
VS2022 Ver.17.8.4 with .net8.0-android34.0 project
Java sources within project those which build-action set to "AndroidJavaSource" causes compile error.
After cleaning the solution or project, the build is successfully, and success to deploy package into device, too.
And .cs files(callable-wrapper files) are generated in /obj/Debug/net8.0-android34.0/generated/src/, but IDE continue to indicate CS0246 error and so on.
After change the source , build is fault with error and files in generated/src are deleted.
We add generated .cs files to the project , IDE's error is disapeared, but build failed with dupulicate definition error.
After all we need to clean→build every time to debug the source.
How can I add Java source code to a project without getting an error?
Original Comments
Feedback Bot on 1/23/2024, 08:52 PM:
(private comment, text removed)
Dean Ellis [MSFT] on 1/24/2024, 06:05 AM:
(private comment, text removed)
デスクトップPC ユーカリ on 1/24/2024, 07:01 AM:
(private comment, text removed)
デスクトップPC ユーカリ on 1/26/2024, 08:27 AM:
(private comment, text removed)
デスクトップPC ユーカリ on 1/26/2024, 04:04 PM:
(private comment, text removed)
Original Solutions
(no solutions)