将.NET Standard类库转换为本地aar / jar [英] Convert .NET Standard class library to native aar/jar

查看:149
本文介绍了将.NET Standard类库转换为本地aar / jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我们正在开发一个.NET Standard类库,该库将由不同的Xamarin。*平台使用。

Currently, we are developing a .NET Standard class library that will be used by different Xamarin.* platforms.

我想知道是否有使用方法

I was wondering if there is a way to use the shared code in a native Android project (maybe produce an AAR/JAR file).

我需要此功能的原因是因为我们公司为其中一个提供了AAR客户(供本地Android项目使用),我们希望保留一个单一的来源库,而不是两个。

The reason I need this functionality is because our company provides an AAR to one of our customers (that is used by a native Android project), and we would like to keep a single source base instead of two.

预先感谢!

推荐答案

更新:



名称更改为 .NET Embedding,它位于此更新时为v0.4。

Update:

The name changed to ".NET Embedding" and it is at v0.4 at the time of this update.

  • https://developer.xamarin.com/releases/dotnetembedding/dotnetembedding_0/dotnetembedding_0.4/
  • Installing .NET Embedding

您可以使用Mono的 Embeddinator- 4000

You can use Mono's Embeddinator-4000


它支持各种语言使用者,因此它以目标语言的惯用代码形式显示.NET代码。这是当前受支持的语言列表:

It supports various language consumers, so it surfaces .NET code as idiomatic code in the target language. This is the list of supported languages at present:




  • Objective-C:将.NET映射到惯用目标-C API。

  • Java:将.NET映射到惯用的Java API。

  • C:将.NET映射到诸如C API的面向对象。


  • Embeddinator-4000是允许您现有的.NET代码(C#,F#等)的工具。

    Embeddinator-4000 is a tool that allows your existing .NET Code (C#, F# and others) to be consumed from other programming languages and in various different environments.

    Java当前处于macOS,Windows和Android的预览状态。

    Java is currently in a preview state for macOS, Windows, and Android.

    通过将--platform =命令行参数传递给embeddinator来选择平台。当前支持macOS,Windows和Android。

    The platform is selected by passing the --platform= command-line argument to the embeddinator. Currently macOS, Windows, and Android are supported.

    re: https://mono.github.io/Embeddinator-4000/

    作为要求的一部分对于Android,您将需要 Xamarin.Android 7.4.99+和Android Studio 3+(Java 1.8),但是如果您要使用Xamarin和Java来构建Android应用, 。

    As a part of the requires For Android you will need Xamarin.Android 7.4.99+ and Android Studio 3+ (Java 1.8) but if you are building Android apps with Xamarin and Java you would have those already.

    注意:此工具位于预览中,因此,请检查未解决的问题并在需要时发布新内容。

    Note: This tool is in Preview, so review the open issues and post new if needed.

    re: https://github.com/mono/Embeddinator-4000/问题

    注意:这不是反编译,而是将Mono的运行时嵌入到允许CIL代码,AOT(即iOS)或不要在其他语言/运行时中运行。

    Note: This is not trans-compiling, but embedding Mono's runtime in a native package that allow CIL code, AOT'd (i.e. iOS) or not to run within a different language/runtime.

    这篇关于将.NET Standard类库转换为本地aar / jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆