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

How to build for android #9889

Closed
hzexe opened this issue Jan 8, 2019 · 5 comments
Closed

How to build for android #9889

hzexe opened this issue Jan 8, 2019 · 5 comments
Labels
doc-enhancement Improve the current content [org][type][category] Pri2 won't fix Issues that were closed as part of automated backlog grooming

Comments

@hzexe
Copy link

hzexe commented Jan 8, 2019

[Enter feedback here]
The RIDs is contain andorid,but no core sdk on android or cross build for it.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@zeroskyx
Copy link

Any feedback on this issue?

Copy link

Trying to build a console with

dotnet publish -r android stankinsv2/solution/StankinsV2/Stankins.Console/Stankins.Console.csproj --self-contained true

The answer is :

NETSDK1056: Project is targeting runtime 'android' but did not resolve any runtime-specific packages. This runtime may not be supported by the target framework.

You can find azure pipeline at
https://github.com/ignatandrei/stankins/

@piccaso
Copy link

piccaso commented Apr 10, 2019

I'm not sure if there ever was (official) android support for dotnet core, but the android RIDs have been removed from the docs in #8710.

@Lemmingh
Copy link

What I've found

I found the following RIDs in the runtime.json

  • android
  • android-arm
  • android-arm64
  • android.21
  • android.21-arm
  • android.21-arm64

They were added at 125bc42 by merging pull request dotnet/corefx#16729 on 2017-03-07.
They were last modified at 81ba628 by merging pull request dotnet/corefx#28560 on 2018-03-30.

I tested them on .NET Core SDK 2.1.801 (Runtime 2.1.12). The result is only android and android.21 led to NETSDK1056 error; all others built successfully.


I am not able to investigate source of .NET, though there are some folders named after android in those repos.

I created a Hello World, built as android-arm64 SCD, and compared binaries.

dotnet new console
dotnet publish --configuration Release --runtime android-arm64

It's obvious that the runtime files are from linux-arm64 in package runtime.linux-arm64.Microsoft.NETCore.App, which means that android-arm64 is implemented by falling back to linux-arm64.

This should be because of the entry

{
  "android-arm64": {
    "#import": [
      "android",
      "linux-arm64"
    ]
  }
}

With a bit more effort, I drew the RID graph
(Only officially available paths are shown)

android.21-arm -> android-arm -> linux-arm -> ...

android.21-arm64 -> android-arm64 -> linux-arm64 -> ...
  • linux-arm is from runtime.linux-arm.Microsoft.NETCore.App
  • linux-arm64 is from runtime.linux-arm64.Microsoft.NETCore.App

The section Do I really need to add a new RID? of Runtime IDs says

Microsoft.NETCore.Platforms attempts to define all RIDs that packages may need, and as such will define RIDs for platforms that we don't actually cross compile for. This is to support higher-level packages, 3rd party packages, that may need to cross-compile for that RID.


The section RID graph of .NET Core RID Catalog | Microsoft Docs, which this issue is related to, says

When NuGet restores packages, it tries to find an exact match for the specified runtime. If an exact match is not found, NuGet walks back the graph until it finds the closest compatible system according to the RID graph.


In pull request dotnet/docs 8710 pointed out by piccaso,
jkotas said on 2018-11-13 that

I would delete the Android section here. There are no official/supported Android packages available today.


There is a similar situation in the issue dotnet/sdk#3037:

Alpine 3.9 RIDs were added in 2019-01, but not supported by all the SDK distros until 2019-04.

Conclusion

.NET may define RIDs for some reason but not implement them immediately.

There are still no direct official packages for Android so far.

The RIDs

  • android-arm
  • android-arm64
  • android.21-arm
  • android.21-arm64

are supported by fallback.

The RIDs

  • android
  • android.21

are defined for hierarchy, but there are no packages available.

Did I miss anything? Thanks.

@tdykstra tdykstra added doc-enhancement Improve the current content [org][type][category] 📚 Area - .NET Core Guide and removed ⌚ Not Triaged Not triaged 📚 Area - .NET Core Guide labels Dec 10, 2019
@PRMerger7 PRMerger7 added the Pri2 label Jan 16, 2021
@dotnet-bot dotnet-bot added the won't fix Issues that were closed as part of automated backlog grooming label Jan 25, 2021
@dotnet-bot
Copy link
Contributor

This issue has been closed as part of the issue backlog grooming process outlined in #22351.

That automated process may have closed some issues that should be addressed. If you think this is one of them, reopen it with a comment explaining why. Tag the @dotnet/docs team for visibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-enhancement Improve the current content [org][type][category] Pri2 won't fix Issues that were closed as part of automated backlog grooming
Projects
None yet
Development

No branches or pull requests

10 participants