Comments (4)
I suspect using <Reference>
is the issue. These .dll
s do not contain the .aar
embedded in them for build performance reasons.
When you reference it as a <PackageReference>
the MSBuild system will run any .targets
files in the NuGet package when you build your project.
If you look in the NuGet you'll see build\monoandroid12.0\Xamarin.AndroidX.Fragment.targets
.
This contains this MSBuild which adds the .aar
to your project:
<ItemGroup>
<AndroidAarLibrary Include="$(MSBuildThisFileDirectory)..\..\aar\androidx.fragment.fragment.aar">
<AndroidXSkipAndroidXMigration>true</AndroidXSkipAndroidXMigration>
</AndroidAarLibrary>
</ItemGroup>
By using a <Reference>
instead of a <PackageReference>
this never gets executed and the .aar
never gets added to your application.
from androidx.
Many thanks @jpobst, all set!
I'm not in a position to switch to <PackageReference>
just yet. But what you explained let me realise I could just add the android library references to the project file directly. They probably would have been added if I'd installed the package properly, rather than just installing them to a folder. Really do need to update our build scripts!
So I have a bunch of additional lines like:
<AndroidAarLibrary Include="$(ProjectDir)..\packages\Xamarin.AndroidX.Fragment\aar\androidx.fragment.fragment.aar"/>
There were already a couple there for Kotlin.StdLib and Kotlin.StdLib.Common.
Sorry, not really an issue in the product then, just support.. but much appreciated. Closing.
from androidx.
Have you added the following NuGet packages to your project?
- Xamarin.AndroidX.Fragment
- Xamarin.AndroidX.Core
from androidx.
Thanks @jpobst, yes I added the new packages and followed the errors in Rider to make sure all implicit dependencies are included too. There are no C# errors now, just these java ones.
I admit I'm not sure how the java side of the bindings work. The java files with errors are in e.g. obj/Debug/android/<guid>/SomeFragment.java
. The lines it's complaining about are:
public class SomeFragment
extends androidx.fragment.app.Fragment <<<<<< javac cannot find androidx.fragment.app
implements
mono.android.IGCUserPeer
I saw in the installed packages there's an aar
folder with e.g. androidx.fragment.fragment.aar
inside. Presumably this is where it should be finding the package from?
One unusual thing here is we restore packages with -ExcludeVersion
to a packages folder within the repo root. Assembly resolution is OK with this due to hint paths, e.g.
<Reference Include="Xamarin.AndroidX.Fragment">
<HintPath>..\packages\Xamarin.AndroidX.Fragment\lib\monoandroid12.0\Xamarin.AndroidX.Fragment.dll</HintPath>
</Reference>
Maybe this causes problems for java package resolution somehow? It didn't have this behaviour on previous versions, but then we're jumping a lot of versions in one go as the app wasn't updated for a couple of years.
from androidx.
Related Issues (20)
- Type-forwarding for binding libraries HOT 3
- Deprecate Xamarin.AndroidX.Legacy.Support.V4 HOT 2
- Bind "androidx.credentials" HOT 16
- [Bug] Lottie package throwing error while creating the release build in Android after switching to target framework 13 HOT 26
- Bind "androidx.health:health-services-client" HOT 34
- Releases - Where are they? HOT 1
- [Bug] `androidx.credentials` null Exception HOT 6
- com.android.tools.r8.ResourceException: com.android.tools.r8.internal.vc: I/O exception while reading HOT 3
- AndroidX.Credentials ICredentialManagerCallback wrong parameter types. HOT 2
- CameraSelector.Builder().AddCameraFilter effectively unusable (cannot select specific camera lens) HOT 2
- Xamarin.AndroidX.Biometric not building starting at version 1.1.0.17 (.NET MAUI) HOT 3
- Issue with CustomTabsActivityManager and multiple activities HOT 3
- Bind "androidx/emoji2/emoji2-picker" HOT 2
- Announcement: Xamarin.Android and .NET 6/7 no longer supported
- "Specified cast is not valid" when using SetOnItemSelectedListener of NavigationBarView HOT 6
- `Xamarin.Jetbrains.Annotations` namespace clash with `JetBrains.Annotations` causes CS0433 build failure HOT 1
- Can't install Xamarin.AndroidX.AppCompat and RecyclerView latest versions into Xamarin project HOT 2
- androidx.profileinstaller.ProfileInstaller.writeProfile java.lang.ClassNotFoundException: Didn't find class "com.google.common.util.concurrent.ListenableFuture" on path: DexPathList HOT 6
- Announcement: .NET 7 no longer supported HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from androidx.