Unity gradle build failed to transform aar - c#

Unity gradle build fail with error. How can i fix it?
I use
android.useAndroidX = true
android.enableJetifier = true
Build fail with error:
Failed to transform '...\Temp\gradleOut\libs\com.android.support.support-v4-26.1.0.aar' using Jetifier. Reason: The given artifact contains a string literal with a package reference 'android.support.v4' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.. (Run with --stacktrace for more details.)
That's my dependencies:
<dependencies>
<packages>
<package>com.android.support:appcompat-v7:24.0.+</package>
<package>com.android.support:support-v4:26.1.+</package>
<package>com.google.android.gms:play-services-ads:15.0.1</package>
<package>com.google.games:gpgs-plugin-support:0.9.62</package>
<package>com.sglib.easymobile:easy-mobile:1.+</package>
</packages>
<files>
<file>Assets/Plugins/Android/android.arch.core.common-1.0.0.jar</file>
<file>Assets/Plugins/Android/android.arch.lifecycle.common-1.0.0.jar</file>
<file>Assets/Plugins/Android/android.arch.lifecycle.runtime-1.0.0.aar</file>
<file>Assets/Plugins/Android/androidx.annotation.annotation-1.0.0.jar</file>
<file>Assets/Plugins/Android/androidx.arch.core.core-common-2.0.0.jar</file>
<file>Assets/Plugins/Android/androidx.arch.core.core-runtime-2.0.0.aar</file>
<file>Assets/Plugins/Android/androidx.asynclayoutinflater.asynclayoutinflater-1.0.0.aar</file>
<file>Assets/Plugins/Android/androidx.browser.browser-1.0.0.aar</file>
<file>Assets/Plugins/Android/androidx.collection.collection-1.0.0.jar</file>
<file>Assets/Plugins/Android/androidx.coordinatorlayout.coordinatorlayout-1.0.0.aar</file>
<file>Assets/Plugins/Android/androidx.core.core-1.0.0.aar</file>
<file>Assets/Plugins/Android/androidx.cursoradapter.cursoradapter-1.0.0.aar</file>
<file>Assets/Plugins/Android/androidx.customview.customview-1.0.0.aar</file>
<file>Assets/Plugins/Android/androidx.documentfile.documentfile-1.0.0.aar</file>
<file>Assets/Plugins/Android/androidx.drawerlayout.drawerlayout-1.0.0.aar</file>
<file>Assets/Plugins/Android/androidx.fragment.fragment-1.0.0.aar</file>
<file>Assets/Plugins/Android/androidx.interpolator.interpolator-1.0.0.aar</file>
<file>Assets/Plugins/Android/androidx.legacy.legacy-support-core-ui-1.0.0.aar</file>
<file>Assets/Plugins/Android/androidx.legacy.legacy-support-core-utils-1.0.0.aar</file>
<file>Assets/Plugins/Android/androidx.lifecycle.lifecycle-common-2.0.0.jar</file>
<file>Assets/Plugins/Android/androidx.lifecycle.lifecycle-livedata-2.0.0.aar</file>
<file>Assets/Plugins/Android/androidx.lifecycle.lifecycle-livedata-core-2.0.0.aar</file>
<file>Assets/Plugins/Android/androidx.lifecycle.lifecycle-runtime-2.0.0.aar</file>
<file>Assets/Plugins/Android/androidx.lifecycle.lifecycle-viewmodel-2.0.0.aar</file>
<file>Assets/Plugins/Android/androidx.loader.loader-1.0.0.aar</file>
<file>Assets/Plugins/Android/androidx.localbroadcastmanager.localbroadcastmanager-1.0.0.aar</file>
<file>Assets/Plugins/Android/androidx.print.print-1.0.0.aar</file>
<file>Assets/Plugins/Android/androidx.slidingpanelayout.slidingpanelayout-1.0.0.aar</file>
<file>Assets/Plugins/Android/androidx.swiperefreshlayout.swiperefreshlayout-1.0.0.aar</file>
<file>Assets/Plugins/Android/androidx.versionedparcelable.versionedparcelable-1.0.0.aar</file>
<file>Assets/Plugins/Android/androidx.viewpager.viewpager-1.0.0.aar</file>
<file>Assets/Plugins/Android/com.android.support.animated-vector-drawable-26.1.0.aar</file>
<file>Assets/Plugins/Android/com.android.support.appcompat-v7-26.1.0.aar</file>
<file>Assets/Plugins/Android/com.android.support.support-annotations-26.1.0.jar</file>
<file>Assets/Plugins/Android/com.android.support.support-compat-26.1.0.aar</file>
<file>Assets/Plugins/Android/com.android.support.support-core-ui-26.1.0.aar</file>
<file>Assets/Plugins/Android/com.android.support.support-core-utils-26.1.0.aar</file>
<file>Assets/Plugins/Android/com.android.support.support-fragment-26.1.0.aar</file>
<file>Assets/Plugins/Android/com.android.support.support-media-compat-26.1.0.aar</file>
<file>Assets/Plugins/Android/com.android.support.support-v4-26.1.0.aar</file>
<file>Assets/Plugins/Android/com.android.support.support-vector-drawable-26.1.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-ads-18.1.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-ads-base-18.1.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-ads-identifier-17.0.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-ads-lite-18.1.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-auth-16.0.1.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-auth-api-phone-16.0.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-auth-base-16.0.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-base-16.0.1.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-basement-17.0.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-drive-16.0.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-games-16.0.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-gass-18.1.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-measurement-17.0.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-measurement-base-17.0.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-measurement-impl-17.0.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-measurement-sdk-17.0.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-measurement-sdk-api-17.0.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-nearby-16.0.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-stats-17.0.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-tasks-16.0.1.aar</file>
<file>Assets/Plugins/Android/com.google.games.gpgs-plugin-support-0.9.62.aar</file>
<file>Assets/Plugins/Android/com.sglib.easymobile.easy-mobile-1.2.0.aar</file>
</files>
</dependencies>

I have update Google Mobile Ads Unity Plugin and problem was solved

Try using the newest SDK version in build.gradle
Ex:
compileSdkVersion 29

Related

Cannot launch wix managed boostrapper with .net6

I’m trying to upgrade my project from wix v3 to wix v4.
The wix project are as follow :
A wix setup
A wix bundle
A wpf .net 6 class library managed
bootstaper
I followed this example https://github.com/wixtoolset/Bal.wixext/tree/master/src/test/examples/WPFCoreMBA and this doc https://wixtoolset.org/docs/development/wips/modify-burn-api/
When I publish the boostraper project, build the bundle and launched it I get this log and errors. How can I fix that ?
[0DA8:0DB4][2023-01-02T18:23:27]e000: Error 0x80131522: Failed to create delegate
through GetFunctionPointer.
[0DA8:0DB4][2023-01-02T18:23:27]e000: Error 0x80131522: Failed to create the .NET Core
bootstrapper application factory.
[0DA8:0DB4][2023-01-02T18:23:27]e000: Error 0x80131522: Failed to create BA.
[0DA8:0DB4][2023-01-02T18:23:27]e000: Error 0x80131522: Failed to load BA.
[0DA8:0DB4][2023-01-02T18:23:27]e000: Error 0x80131522: Failed while running
The bundle.wxs
<BootstrapperApplication>
<Payload SourceFile="..\LanguageSelector\bin\Release\net6.0-windows\publish\win-x86\LanguageSelector.dll" Name="LanguageSelector.dll" bal:BAFactoryAssembly="yes" />
<Payload SourceFile="..\LanguageSelector\bin\Release\net6.0-windows\publish\win-x86\LanguageSelector.deps.json" Name="LanguageSelector.deps.json"/>
<Payload SourceFile="..\LanguageSelector\bin\Release\net6.0-windows\publish\win-x86\LanguageSelector.runtimeconfig.json" Name="LanguageSelector.runtimeconfig.json" />
<Payload SourceFile="..\LanguageSelector\bin\Release\net6.0-windows\publish\win-x86\WixToolset.Mba.Core.dll" Name="WixToolset.Mba.Core.dll" />
<Payload SourceFile="..\LanguageSelector\bin\Release\net6.0-windows\publish\win-x86\mbanative.dll" Name="mbanative.dll" />
<Payload SourceFile="..\LanguageSelector\bin\Release\net6.0-windows\publish\win-x86\GalaSoft.MvvmLight.dll" Name="GalaSoft.MvvmLight.dll" />
<bal:WixDotNetCoreBootstrapperApplicationHost />
The LanguageSelectorFactory0cs
[assembly: WixToolset.Mba.Core.BootstrapperApplicationFactory(typeof(LanguageSelector.LanguageSelectorFactory))]
namespace LanguageSelector
{
using WixToolset.Mba.Core;
public class LanguageSelectorFactory : BaseBootstrapperApplicationFactory
{
private static int loadCount = 0;
protected override IBootstrapperApplication Create(IEngine engine,
IBootstrapperCommand bootstrapperCommand)
{
if (loadCount > 0)
{
engine.Log(LogLevel.Standard, $"Reloaded {loadCount} time(s)");
}
++loadCount;
return new LanguageSelector(engine, bootstrapperCommand);
}
}
}
In your project file (.csproj) for bootstrapper application (your custom UI application known as BA) you have to add a reference to WixToolset.Dnc.HostGenerator package using Package manager console:
Install-Package WixToolset.Dnc.HostGenerator -Version 4.0.0-rc.1
Alternatively, make sure you have the required references in the mentioned BA project file:
<ItemGroup>
<PackageReference Include="WixToolset.Mba.Core" Version="4.0.0-rc.1" />
<PackageReference Include="WixToolset.Dnc.HostGenerator" Version="4.0.0-rc.1" />
</ItemGroup>
The managed BA assembly targeting .NET 6 or later requires WixToolset.Dnc.HostGenerator. Dnc is the abbreviation for Dot Net Core.
Once you have all this set, build and published you have to ensure the entire project output goes to Wix Payload. Including WixToolset.Mba.Core.dll and mbanative.dll. So, your Bundle.wxs have to include these DLLs. In your case should be something like:
<Payload SourceFile="..\LanguageSelector\bin\Release\net6.0-windows\publish\win-x86\mbanative.dll" />
<Payload SourceFile="..\LanguageSelector\bin\Release\net6.0-windows\publish\win-x86\WixToolset.Mba.Core.dll" />
It could be a lot of DLLs in the project output. So, I personally use the HarvestDirectory functionality in .wixproj to harvest project output directory as a PayloadGroup section. Let me know if you need more details on this.

`Failed resolution of: Lcom/google/android/datatransport/TransportFactory` when using Xamarin.Firebase

I'm creating a .NET MAUI application using the current preview 11.
When I tried to implement Push notifications I added the Xamarin.Firebase.Messaging package and just adding this package causes a crash when starting the app with the exception:
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/datatransport/TransportFactory;
at com.google.firebase.datatransport.TransportRegistrar.getComponents(TransportRegistrar.java:32)
at com.google.firebase.components.ComponentRuntime.discoverComponents(ComponentRuntime.java:109)
at com.google.firebase.components.ComponentRuntime.(ComponentRuntime.java:91)
at com.google.firebase.components.ComponentRuntime.(ComponentRuntime.java:45)
at com.google.firebase.components.ComponentRuntime$Builder.build(ComponentRuntime.java:360)
at com.google.firebase.FirebaseApp.(FirebaseApp.java:427)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:299)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:267)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:252)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(FirebaseInitProvider.java:51)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2388)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2358)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(FirebaseInitProvider.java:45)
at android.app.ActivityThread.installProvider(ActivityThread.java:7239)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6780)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6697)
at android.app.ActivityThread.access$1300(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.datatransport.TransportFactory" on path: DexPathList[[zip file "/data/app/.../base.apk"],nativeLibraryDirectories=[/data/app/.../lib/x86_64, /data/app/.../base.apk!/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 24 more
During the build I get the following warnings:
Warning in obj\Debug\net6.0-android\lp\153\jl\classes.jar:com/google/firebase/datatransport/TransportRegistrar.class:
Type com.google.android.datatransport.runtime.TransportRuntime was not found, it is required for default or static interface methods desugaring of Lcom/google/firebase/datatransport/TransportRegistrar;lambda$getComponents$0(Lcom/google/firebase/components/ComponentContainer;)Lcom/google/android/datatransport/TransportFactory;
Via trail and error I found out this happens for all Xamarin.Firebase.* packages, but not when referencing e.g. Xamarin.Google.Android.DataTransport.TransportRuntime directly.
How can I fix this?
I found a workaround:
Basically the newest version of the firebase packages are broken. Using the following packages worked:
<ItemGroup>
<PackageReference Include="Xamarin.Build.Download" Version="0.11.0" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.Contains('-android'))">
<PackageReference Include="Xamarin.Google.Dagger" Version="2.39.1" />
<PackageReference Include="Xamarin.Firebase.Messaging" Version="122.0.0.2" />
<PackageReference Include="Xamarin.GooglePlayServices.Base" Version="117.6.0.2" />
</ItemGroup>
As soon as I use the versions ending with .3 instead of .2 for the last two its broken...

Blazor proj from scratch+nuget: "There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'browser-wasm'"

[Final update 07.12.2020 23:50 --> for everyone seeking for the anwser]
You are probably adding some nuget package which has in fields DEPENDENCIES .NET Core 3.1. For example Serilog.AspNetCore 3.4.0. In this very example you can include Serilog.AspNetCore 3.2.0 because it has in DEPENDENCIES only .NetStandard 2.0. See more explanation in #Ogglas answer.
There is not enough space on earth to ask the one and only question: "Why, o why Microsoft?":) The message is not clearly correlating issue with the solution - this is the lightest euphemism i am capable of making :)
For me, Blazor is very promising but it is still more a beta version. And not only for me. The startblazoring guys are claiming, that Blazor can be fickle sometimes. And I cannot agree more;) I am keeping finger crossed for it. But I suppose it would be a "ready product" only after .NET 6.0.
[Original Topic]
This is so frustrating :)
I hate errors, when I cannot simply interact and understood where it is coming from. I know, I am ignorant, and If I would pay more attention to "how is the blazor app created" I would understand in eye blink.
But for now it is only frustrating. What is? The error message:
Severity Code Description Project File Line Suppression State
Error NETSDK1082 There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'browser-wasm'. TestBlazorAppNoRuntimeError.Client C:\Program Files\dotnet\sdk\5.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets 387
Really, what can you fix here?:D Ehhhhh. I understand that .NET 5 is a "new thing". I understand Blazor is a "new thing" But really? It is really easy to "break" ;) (with a message that is saying nothing)
So what did I do?
Did I create very complicated project with hundreds of thousands of files?
No
Did I add hundreds of thousands of nuget packages.
No
All it takes is to create Blazor Webassembly app and add one nuget package to the shared (common) library (FYI: IdentityServer4 package). That is all folks. Kudos if you would now, that this package specificly is causing this issue (because i found out only by mistake):
There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'browser-wasm'.
Really, there is a great correlation here: between the error message and the package being added (this was sarcasm if anyone missed it:) )
So if you want to reproduce it create create "Blazor Webassembly":
I don't suppose the options chosen are making the difference. But if this is the case - you can see what option I did choose. Then just add IdentityServer4 nuget package to shared library:
https://www.nuget.org/packages/IdentityServer4/
That is all
If you are too lazy - download this project and check for yourself:
https://ufile.io/751l5wgq
I saw hundreds of SOF topics regarding this message:
There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'browser-wasm'.
But none of those was so easy to reproduce.
Why I am creating this topic?
Because I did try to implement (by copy-pasting to my solution) what guys did create in Blazor boilerplate here:
https://github.com/enkodellc/blazorboilerplate
At the beginning, by mistake, I've added Identity4 NuGet instead of Identity4.storage and that is why I did observe such behavior (such error) and did correlate this package with this error. When I rolled back from Identity4 to Identity4.storage everything was correct once again. But after that I did a lot of code transfer from this repository. And once I've ended, right now, everything is compiling but once again I have:
There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'browser-wasm'.
And it is driving me crazy. Maybe you would have some idea, how to find out WHAT is causing this error (exactly the same as previously Identity4 nuget package was causing it)
[UPDATE 06.12.2020 12:30]
The question here is more: "Why is it happening and how to locate package causing the issue" I know that I can second guess what is causing this message to appear.
I did a little investigation. This error is showing in this target:
<ResolveRuntimePackAssets FrameworkReferences="#(FrameworkReference)"
ResolvedRuntimePacks="#(ResolvedRuntimePack)"
UnavailableRuntimePacks="#(UnavailableRuntimePack)"
SatelliteResourceLanguages="$(SatelliteResourceLanguages)"
DesignTimeBuild="$(DesignTimeBuild)">
<Output TaskParameter="RuntimePackAssets" ItemName="RuntimePackAsset" />
</ResolveRuntimePackAssets>
<ItemGroup>
<ReferenceCopyLocalPaths Include="#(RuntimePackAsset)"
Condition="'$(CopyLocalLockFileAssemblies)' == 'true' and ('$(SelfContained)' == 'true' or '%(RuntimePackAsset.RuntimePackAlwaysCopyLocal)' == 'true')" />
</ItemGroup>
so I did google ResolveRuntimePackAssets and found this repo and this file:
https://github.com/dotnet/sdk/blob/release/5.0.2xx/src/Tasks/Microsoft.NET.Build.Tasks/ResolveRuntimePackAssets.cs and such code:
foreach (var unavailableRuntimePack in UnavailableRuntimePacks)
{
if (frameworkReferenceNames.Contains(unavailableRuntimePack.ItemSpec))
{
// This is a runtime pack that should be used, but wasn't available for the specified RuntimeIdentifier
// NETSDK1082: There was no runtime pack for {0} available for the specified RuntimeIdentifier '{1}'.
Log.LogError(Strings.NoRuntimePackAvailable, unavailableRuntimePack.ItemSpec,
unavailableRuntimePack.GetMetadata(MetadataKeys.RuntimeIdentifier));
}
}
Looks like the code "causing" the issue (this calls for writing down information in message about: unavailableRuntimePack.ItemSpec - it would be so much easier;))
So right now the only thing is to locate what is filling this: UnavailableRuntimePacks property. I don't see any code doing that so it have to be some reflection. I've located this code which is probably doing it:
https://github.com/dotnet/sdk/blob/release/5.0.2xx/src/Tasks/Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs
And this method:
private void ProcessRuntimeIdentifier(
string runtimeIdentifier,
KnownRuntimePack selectedRuntimePack,
string runtimePackVersion,
List<string> additionalFrameworkReferencesForRuntimePack,
HashSet<string> unrecognizedRuntimeIdentifiers,
List<ITaskItem> unavailableRuntimePacks,
List<ITaskItem> runtimePacks,
List<ITaskItem> packagesToDownload,
string isTrimmable,
bool addToPackageDownload)
{
var runtimeGraph = new RuntimeGraphCache(this).GetRuntimeGraph(RuntimeGraphPath);
var knownFrameworkReferenceRuntimePackRuntimeIdentifiers = selectedRuntimePack.RuntimePackRuntimeIdentifiers.Split(';');
string runtimePackRuntimeIdentifier = NuGetUtils.GetBestMatchingRid(
runtimeGraph,
runtimeIdentifier,
knownFrameworkReferenceRuntimePackRuntimeIdentifiers,
out bool wasInGraph);
if (runtimePackRuntimeIdentifier == null)
{
if (wasInGraph)
{
// Report this as an error later, if necessary. This is because we try to download
// all available runtime packs in case there is a transitive reference to a shared
// framework we don't directly reference. But we don't want to immediately error out
// here if a runtime pack that we might not need to reference isn't available for the
// targeted RID (e.g. Microsoft.WindowsDesktop.App for a linux RID).
var unavailableRuntimePack = new TaskItem(selectedRuntimePack.Name);
unavailableRuntimePack.SetMetadata(MetadataKeys.RuntimeIdentifier, runtimeIdentifier);
unavailableRuntimePacks.Add(unavailableRuntimePack);
}
else if (!unrecognizedRuntimeIdentifiers.Contains(runtimeIdentifier))
{
// NETSDK1083: The specified RuntimeIdentifier '{0}' is not recognized.
Log.LogError(Strings.RuntimeIdentifierNotRecognized, runtimeIdentifier);
unrecognizedRuntimeIdentifiers.Add(runtimeIdentifier);
}
}
else if (addToPackageDownload)
{
foreach (var runtimePackNamePattern in selectedRuntimePack.RuntimePackNamePatterns.Split(';'))
{
string runtimePackName = runtimePackNamePattern.Replace("**RID**", runtimePackRuntimeIdentifier);
if (runtimePacks != null)
{
TaskItem runtimePackItem = new TaskItem(runtimePackName);
runtimePackItem.SetMetadata(MetadataKeys.NuGetPackageId, runtimePackName);
runtimePackItem.SetMetadata(MetadataKeys.NuGetPackageVersion, runtimePackVersion);
runtimePackItem.SetMetadata(MetadataKeys.FrameworkName, selectedRuntimePack.Name);
runtimePackItem.SetMetadata(MetadataKeys.RuntimeIdentifier, runtimePackRuntimeIdentifier);
runtimePackItem.SetMetadata(MetadataKeys.IsTrimmable, isTrimmable);
if (selectedRuntimePack.RuntimePackAlwaysCopyLocal)
{
runtimePackItem.SetMetadata(MetadataKeys.RuntimePackAlwaysCopyLocal, "true");
}
if (additionalFrameworkReferencesForRuntimePack != null)
{
runtimePackItem.SetMetadata(MetadataKeys.AdditionalFrameworkReferences, string.Join(";", additionalFrameworkReferencesForRuntimePack));
}
runtimePacks.Add(runtimePackItem);
}
TaskItem packageToDownload = new TaskItem(runtimePackName);
packageToDownload.SetMetadata(MetadataKeys.Version, runtimePackVersion);
packagesToDownload.Add(packageToDownload);
}
}
}
After analysing it, the reason why Identity4 (for example) is causing this issue is because runtimePackRuntimeIdentifier is null and wasInGraph was true :) But what does mean, we have to dig a little bit further. The key thing here is the method GetBestMatchingRid:
public static string GetBestMatchingRid(RuntimeGraph runtimeGraph, string runtimeIdentifier,
IEnumerable<string> availableRuntimeIdentifiers, out bool wasInGraph)
{
wasInGraph = runtimeGraph.Runtimes.ContainsKey(runtimeIdentifier);
HashSet<string> availableRids = new HashSet<string>(availableRuntimeIdentifiers);
foreach (var candidateRuntimeIdentifier in runtimeGraph.ExpandRuntime(runtimeIdentifier))
{
if (availableRids.Contains(candidateRuntimeIdentifier))
{
return candidateRuntimeIdentifier;
}
}
// No compatible RID found in availableRuntimeIdentifiers
return null;
}
So here we see that runtimePackRuntimeIdentifier was null because it was not found on: availableRuntimeIdentifiers. And this variable is defined as:
var knownFrameworkReferenceRuntimePackRuntimeIdentifiers = selectedRuntimePack.RuntimePackRuntimeIdentifiers.Split(';');
So let's see how is it defined (in the code below variable runtimePackForRuntimeIDProcessing is selectedRuntimePack from the above mention)
KnownRuntimePack runtimePackForRuntimeIDProcessing;
if (knownFrameworkReference.Name.Equals(knownFrameworkReference.RuntimeFrameworkName, StringComparison.OrdinalIgnoreCase))
{
// Only add runtime packs where the framework reference name matches the RuntimeFrameworkName
// Framework references for "profiles" will use the runtime pack from the corresponding non-profile framework
runtimePackForRuntimeIDProcessing = selectedRuntimePack.Value;
includeInPackageDownload = true;
}
else if (!knownFrameworkReference.RuntimePackRuntimeIdentifiers.Equals(selectedRuntimePack?.RuntimePackRuntimeIdentifiers))
{
// If the profile has a different set of runtime identifiers than the runtime pack, use the profile.
runtimePackForRuntimeIDProcessing = knownFrameworkReference.ToKnownRuntimePack();
includeInPackageDownload = true;
}
else
{
// For the remaining profiles, don't include them in package download but add them to unavaliable if necessary.
runtimePackForRuntimeIDProcessing = knownFrameworkReference.ToKnownRuntimePack();
includeInPackageDownload = false;
}
But this is as far as I can go. I don't understand without further investigation how this selectedRuntimePack.RuntimePackRuntimeIdentifiers should be defined. This is the key thing here. Clearly for some reasons IdentityServer4 doesn't belong to selectedRuntimePack.RuntimePackRuntimeIdentifiers and this is the answer I am looking for :)
IdentityServer4 4.1.1 (latest version) is dependent upon .NETCoreApp 3.1
https://www.nuget.org/packages/IdentityServer4/
If you create a Blazor WebAssembly App using .NET Core 3.1 it will work in the Server App.
However when using .NET Core 3.1 both Client and Shared uses .NET Standard 2.1 and is therefore not compatible. These error messages are a lot clearar though:
Error Package restore failed. Rolling back package changes for
'BlazorApp.Shared'.
Error NU1202 Package IdentityServer4 4.1.1 is not compatible with
netstandard2.1 (.NETStandard,Version=v2.1). Package IdentityServer4
4.1.1 supports: netcoreapp3.1 (.NETCoreApp,Version=v3.1) BlazorApp.Shared
As I mentioned in this link, it seems there is an issue regarding to the following package. So remove the package from your project and every other project that has been referenced by your Blazor project(right-click on project, choose edit project file then remove the following):
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.0" />
In my case (and hopefully in yours too) the only use of this package was the get the constant string "Bearer" with the field member JwtBearerDefaults.AuthenticationScheme. So instead of this just simply use "Bearer" string.
I had the same issue while working on a blazor wasm/server/shared projects. In my case, I narrowed down the issue to the project sdk types:
Client.csproj:
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
Server.csproj:
<Project Sdk="Microsoft.NET.Sdk.Web">
Shared.csproj definition causing the issue:
<Project Sdk="Microsoft.NET.Sdk.Razor">
Shared.csproj definition without issue:
<Project Sdk="Microsoft.NET.Sdk">
The client wasm project did not like that the shared one was declared as Microsoft.NET.Sdk.Razor and had to change it to Microsoft.NET.Sdk in order to get rid of the error in the title.
I still need to dig further in to better understand the full differences between those two project types but I hope this can help anyone else facing this issue.

Sharpie pod bind: unable to parse target sdk

I am creating an Appletvos project in c# using Xamarin and I need to use the VLCKit library, I tried using cocoapod and sharpie to create this project but I Have an error on the
sharpie pod bind
it correctly create a build directory with the file of my VLCKit but after it say
Check dependencies
** BUILD SUCCEEDED **
error: unable to parse target SDK from platform in Podfile
I don't understand since the command
pod install
worked correctly.
this is my podfile:
install! 'cocoapods', :integrate_targets => false
target 'ObjectiveSharpieIntegration' do
platform :tvos, '11.2'
use_frameworks!
pod 'TVVLCKit-unstable', '3.0.0a50'
end
this Is how my terminal look like
Berthiers-MacBook-Air:project berthierhadrien$ pod install
Analyzing dependencies
Downloading dependencies
Installing TVVLCKit-unstable (3.0.0a24)
Generating Pods project
Skipping User Project Integration
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
Berthiers-MacBook-Air:project berthierhadrien$ sharpie pod bind VLC_Binder
User defaults from command line:
IDEDerivedDataPathOverride = /Users/berthierhadrien/project/Pods/sharpie-build
=== BUILD TARGET Pods-ObjectiveSharpieIntegration OF PROJECT Pods WITH CONFIGURATION Release ===
Check dependencies
Write auxiliary files
write-file /Users/berthierhadrien/project/build/Pods.build/Release-appletvos/Pods-ObjectiveSharpieIntegration.build/Pods-ObjectiveSharpieIntegration-all-non-framework-target-headers.hmap
write-file /Users/berthierhadrien/project/build/Pods.build/Release-appletvos/Pods-ObjectiveSharpieIntegration.build/Pods-ObjectiveSharpieIntegration.hmap
write-file /Users/berthierhadrien/project/build/Pods.build/Release-appletvos/Pods-ObjectiveSharpieIntegration.build/Pods-ObjectiveSharpieIntegration-project-headers.hmap
write-file /Users/berthierhadrien/project/build/Pods.build/Release-appletvos/Pods-ObjectiveSharpieIntegration.build/Pods-ObjectiveSharpieIntegration-generated-files.hmap
write-file /Users/berthierhadrien/project/build/Pods.build/Release-appletvos/Pods-ObjectiveSharpieIntegration.build/Pods-ObjectiveSharpieIntegration-own-target-headers.hmap
write-file /Users/berthierhadrien/project/build/Pods.build/Release-appletvos/Pods-ObjectiveSharpieIntegration.build/Pods-ObjectiveSharpieIntegration-all-target-headers.hmap
/bin/mkdir -p /Users/berthierhadrien/project/build/Pods.build/Release-appletvos/Pods-ObjectiveSharpieIntegration.build/Objects-normal/arm64
write-file /Users/berthierhadrien/project/build/Pods.build/Release-appletvos/Pods-ObjectiveSharpieIntegration.build/Objects-normal/arm64/Pods-ObjectiveSharpieIntegration.LinkFileList
CompileC /Users/berthierhadrien/project/build/Pods.build/Release-appletvos/Pods-ObjectiveSharpieIntegration.build/Objects-normal/arm64/Pods-ObjectiveSharpieIntegration-dummy.o Target\ Support\ Files/Pods-ObjectiveSharpieIntegration/Pods-ObjectiveSharpieIntegration-dummy.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/berthierhadrien/project/Pods
export LANG=en_US.US-ASCII
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/GDAL.framework/Programs"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch arm64 -fmessage-length=137 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -fcolor-diagnostics -std=gnu11 -fobjc-arc -fmodules -fmodules-cache-path=/Users/berthierhadrien/project/Pods/sharpie-build/ModuleCache -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/berthierhadrien/project/Pods/sharpie-build/ModuleCache/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -Os -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wdocumentation -Wunreachable-code -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DPOD_CONFIGURATION_RELEASE=1 -DCOCOAPODS=1 -DNS_BLOCK_ASSERTIONS=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS11.2.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -mtvos-version-min=11.2 -g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wunguarded-availability -fembed-bitcode-marker -iquote /Users/berthierhadrien/project/build/Pods.build/Release-appletvos/Pods-ObjectiveSharpieIntegration.build/Pods-ObjectiveSharpieIntegration-generated-files.hmap -I/Users/berthierhadrien/project/build/Pods.build/Release-appletvos/Pods-ObjectiveSharpieIntegration.build/Pods-ObjectiveSharpieIntegration-own-target-headers.hmap -I/Users/berthierhadrien/project/build/Pods.build/Release-appletvos/Pods-ObjectiveSharpieIntegration.build/Pods-ObjectiveSharpieIntegration-all-target-headers.hmap -iquote /Users/berthierhadrien/project/build/Pods.build/Release-appletvos/Pods-ObjectiveSharpieIntegration.build/Pods-ObjectiveSharpieIntegration-project-headers.hmap -I/Users/berthierhadrien/project/build/Release-appletvos/include -I/Users/berthierhadrien/project/Pods/Headers/Public -I/Users/berthierhadrien/project/Pods/Headers/Public/TVVLCKit-unstable -I/Users/berthierhadrien/project/build/Pods.build/Release-appletvos/Pods-ObjectiveSharpieIntegration.build/DerivedSources/arm64 -I/Users/berthierhadrien/project/build/Pods.build/Release-appletvos/Pods-ObjectiveSharpieIntegration.build/DerivedSources -F/Users/berthierhadrien/project/build/Release-appletvos -F/Users/berthierhadrien/project/Pods/TVVLCKit-unstable/TVVLCKit-binary -isystem /Users/berthierhadrien/project/Pods/Headers/Public -isystem /Users/berthierhadrien/project/Pods/Headers/Public/TVVLCKit-unstable -MMD -MT dependencies -MF /Users/berthierhadrien/project/build/Pods.build/Release-appletvos/Pods-ObjectiveSharpieIntegration.build/Objects-normal/arm64/Pods-ObjectiveSharpieIntegration-dummy.d --serialize-diagnostics /Users/berthierhadrien/project/build/Pods.build/Release-appletvos/Pods-ObjectiveSharpieIntegration.build/Objects-normal/arm64/Pods-ObjectiveSharpieIntegration-dummy.dia -c /Users/berthierhadrien/project/Pods/Target\ Support\ Files/Pods-ObjectiveSharpieIntegration/Pods-ObjectiveSharpieIntegration-dummy.m -o /Users/berthierhadrien/project/build/Pods.build/Release-appletvos/Pods-ObjectiveSharpieIntegration.build/Objects-normal/arm64/Pods-ObjectiveSharpieIntegration-dummy.o
Libtool /Users/berthierhadrien/project/build/Release-appletvos/libPods-ObjectiveSharpieIntegration.a normal arm64
cd /Users/berthierhadrien/project/Pods
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/GDAL.framework/Programs"
export TVOS_DEPLOYMENT_TARGET=11.2
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only arm64 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS11.2.sdk -L/Users/berthierhadrien/project/build/Release-appletvos -filelist /Users/berthierhadrien/project/build/Pods.build/Release-appletvos/Pods-ObjectiveSharpieIntegration.build/Objects-normal/arm64/Pods-ObjectiveSharpieIntegration.LinkFileList -framework Foundation -o /Users/berthierhadrien/project/build/Release-appletvos/libPods-ObjectiveSharpieIntegration.a
** BUILD SUCCEEDED **
error: unable to parse target SDK from platform in Podfile
Do you know a way to fix this or how to create the bind project I need?
(also can anyone tell me if the instruction for an IOS library and TVOS library are the same I only found documentation for IOS)
(also Can I use IOS, MACOS library in TVOS project in C# using Xamarin)
Thanks
I know it's been a while, but I didn't find this until I end up with the same issue.
It took me a while to figure out, but I got it thanks to the clue of the error message.
What's happening here is Objective Sharpie trying to get a platform SDK from the Podfile.
So, following CocoaPods Syntax Reference at the end of your Podfile, just add:
platform :ios, '14.5' //14.5 or whatever
Now run again
sharpie pod bind
And if everything went good, it should output at the end
Binding...
[write] ApiDefinitions.cs
[write] StructsAndEnums.cs

UWP: Cannot load PWM Controllers using Lightning on Raspberry Pi 2?

i justed started working on an older Project i started once, but unfortunately the PWM Controller is not working anymore with the Lightning Driver. I am using Visual Studio 2017, the RPi2 is running at 10.0.15063.414 and I've installed the following Nuget-Packages:
Microsoft.IoT.Lightning (v1.1.0)
Microsoft.NETCore.UniversalWindowsPlatform (v5.3.3)
WinRTXamlToolkit.Controls.DataVisualization (v2.3.0)
The Project includes references to
Analyzer
Microsoft.IoT.Lightning
Microsoft.NETCore.UniversalWindowsPlatform
%ClassesLibrary%
UniversalWindows
Windows IoT Extensions for the UWP
WinRTXamlToolkit.Controls.DataVisualization,
where %ClassesLibrary% is an user-defined Project containing some classes for my Project. In the configuration web Interface of Windows IoT Core in the devices section, the Direct Memory Mapped Driver (Current Driver) is selected.
My initialization Code Looks like this
private static async Task InitOnboardHardware()
{
if (LightningProvider.IsLightningEnabled)
{
LowLevelDevicesController.DefaultProvider = LightningProvider.GetAggregateProvider();
GpioController gpioController = GpioController.GetDefault();
var pwmControllers = await PwmController.GetControllersAsync(LightningPwmProvider.GetPwmProvider());
if (pwmControllers != null)
{
m_PWMController = pwmControllers[1];
//m_PWMController = (await PwmController.GetControllersAsync(LightningPwmProvider.GetPwmProvider()))[1];
m_PWMController.SetDesiredFrequency(100);
m_RPin = m_PWMController.OpenPin(18);
m_GPin = m_PWMController.OpenPin(23);
m_BPin = m_PWMController.OpenPin(24);
m_WPin = m_PWMController.OpenPin(25);
m_RPin.SetActiveDutyCyclePercentage(0);
m_GPin.SetActiveDutyCyclePercentage(0);
m_BPin.SetActiveDutyCyclePercentage(0);
m_WPin.SetActiveDutyCyclePercentage(0);
m_RPin.Start();
m_GPin.Start();
m_BPin.Start();
m_WPin.Start();
m_IsHardwareInitialized = true;
}
}
}
The PwmController.GetControllersAsync-method never completes and my application gets stuck on starting up. Also the commented Shorter Version is not working anymore?!
I have really no clue what i could be missing. Therefore, i would greatly appreciate any help.
Thank you in advance!
EDIT: I also tried another sample (https://github.com/lprichar/WindowsIotPwmExample), where i replaced the embedded C/C++ lightning library by the NuGet Package (same Version as in my Project). The sample also Fails: the Pins are all null, because PwmController.GetControllersAsync never completes :-(
EDIT2: I forgot to mention that my package.appxmanifest file also includes the following changes
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:iot="http://schemas.microsoft.com/appx/manifest/iot/windows10"
IgnorableNamespaces="uap mp iot">
as well as
<Capabilities>
<Capability Name="internetClient" />
<iot:Capability Name="lowLevelDevices" />
<DeviceCapability Name="109b86ad-f53d-4b76-aa5f-821e2ddf2141" />
</Capabilities>
Please also see my comment to the first post. I had to Change this line
GpioController gpioController = GpioController.GetDefault();
to an async method call
GpioController gpioController = await GpioController.GetDefaultAsync();
and now everythings runs fine!

Categories