Skip to content

Java source file set build-action "AndoidJavaSource" in project causes compile error #8698

Description

@vsfeedback

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)

Activity

  1. added
    Area: App+Library BuildIssues when building Library projects or Application projects.
    and removed
    needs-triageIssues that need to be assigned.
    on Feb 2, 2024
  2. StudioLMZa commented on Feb 8, 2024

    @StudioLMZa

    This is the bug?
    Is interoperability between C# and Java impossible at the source code level?

  3. dellis1972 commented on Feb 8, 2024

    @dellis1972
    Contributor

    Do you have a sample which demonstrates the issue?

  4. added
    need-infoIssues that need more information from the author.
    on Feb 8, 2024
  5. added
    need-attentionA xamarin-android contributor needs to review
    and removed
    need-infoIssues that need more information from the author.
    on Feb 8, 2024
  6. StudioLMZa commented on Feb 8, 2024

    @StudioLMZa

    Do you have a sample which demonstrates the issue?

    This is the sample to reproduce.
    AndroidApp2.zip
    image

  7. dellis1972 commented on Feb 8, 2024

    @dellis1972
    Contributor

    @StudioLMZa

    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".

  8. removed
    need-attentionA xamarin-android contributor needs to review
    on Feb 9, 2024
  9. StudioLMZa commented on Feb 9, 2024

    @StudioLMZa

    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?

  10. dellis1972 commented on Feb 9, 2024

    @dellis1972
    Contributor

    ok, so its Intellisense which is not working.

  11. StudioLMZa commented on Feb 9, 2024

    @StudioLMZa

    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.

  12. dellis1972 commented on Feb 9, 2024

    @dellis1972
    Contributor

    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 the Install target is deleting the .cs files, I'm going to be looking at that next week.

  13. StudioLMZa commented on Feb 21, 2024

    @StudioLMZa

    Has there been any progress about this issue?

  14. dellis1972 commented on Feb 21, 2024

    @dellis1972
    Contributor

    This PR is working on the issue #8706

  15. StudioLMZa commented on Feb 21, 2024

    @StudioLMZa

    Thank you for the information.

  16. added a commit that references this issue on Mar 25, 2024
  17. locked and limited conversation to collaborators on Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Area: App+Library BuildIssues when building Library projects or Application projects.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions