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

[Xamarin.Android.Build.Tasks] Unable to use import androidx.appcompat.widget.Toolbar into a java file when using AndroidJavaSource #8194

Merged
merged 2 commits into from
Sep 21, 2023

Conversation

dellis1972
Copy link
Contributor

@dellis1972 dellis1972 commented Jul 18, 2023

Fixes #8191

The implementation of AndroidJavaSource was missing one component. It was missing references to the classes.jar files which are extracted to the $(IntemediateOutputPath)lp directory. As a result we end up with
errors such as the following

Error	JAVAC0000	 error: package androidx.appcompat.widget does not exist

What was missing was a dependency on the _GetLibraryImports target. This target will call the chain of
targets which extracts the dependent classes.jar files and populates the @(Jars) ItemGroup which is used in the _CompileBindingJava target. This should allow users to write simple wrapper methods in Java that wrap more
complex API.

@dellis1972 dellis1972 force-pushed the Issue8191 branch 2 times, most recently from 5c6f6fa to f195e91 Compare July 20, 2023 09:22
@dellis1972 dellis1972 marked this pull request as ready for review July 20, 2023 12:10
Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a test? I guess it could be an app with one *.java file using an AndroidX type?

@dellis1972
Copy link
Contributor Author

Should we add a test? I guess it could be an app with one *.java file using an AndroidX type?

Done :)

@dellis1972
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

….widget.Toolbar into a java file when using AndroidJavaSource

Fixes dotnet#8191

TODO
@jonpryor jonpryor merged commit 589b6e3 into dotnet:main Sep 21, 2023
@dellis1972 dellis1972 deleted the Issue8191 branch September 21, 2023 21:59
grendello added a commit to grendello/xamarin-android that referenced this pull request Sep 22, 2023
* main:
  [Xamarin.Android.Build.Tasks] Add `RunWithLogging` target (dotnet#8324)
  [Xamarin.Android.Build.Tasks] AndroidJavaSource refs dependent jars (dotnet#8194)
  Bump to xamarin/Java.Interop/main@75d8221 (dotnet#8336)
  Bump NDK to r26 (dotnet#8213)
@github-actions github-actions bot locked and limited conversation to collaborators Jan 22, 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.

Unable to use import androidx.appcompat.widget.Toolbar into a java file when using AndroidJavaSource
3 participants