如何在 Xamarin 中制作自定义库并导入到单独的应用程序? [英] How to make custom libraries in Xamarin and import to seperate applications?

查看:35
本文介绍了如何在 Xamarin 中制作自定义库并导入到单独的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个包含很少活动和逻辑的 Xamarin 库.然后我需要将它导入到主应用程序并使用它.我正在使用 Visual Studio 进行开发.这是可能的吗?我已经在 android studio 中使用 .aar 文件完成了此操作,但在 c# 中不确定

I need to create a Xamarin library that contains few activities and logic. Then I need to import it to the main application and use it. I'm using visual studio for development. Is this possible to do? I have done this in android studio with .aar files but not sure in c#

推荐答案

有可能.

您只需从 Android .AAR 文件创建 Xamarin.Android Java 绑定库.

You only need to create a Xamarin.Android Java Bindings Library from an Android .AAR file.

我们将使用以下步骤从 .AAR 文件创建绑定库:

We'll use the following steps to create a Bindings Library from the .AAR file:

  1. 创建一个新的 Java 绑定库项目.

  1. Create a new Java Bindings Library project.

向项目添加单个 .AAR 文件.一个绑定项目只能包含一个 .AAR.

Add a single .AAR file to the project. A binding project may only contain a single .AAR.

为 .AAR 文件设置适当的构建操作.

Set the appropriate build action for the .AAR file.

选择 .AAR 支持的目标框架.

Choose a target framework that the .AAR supports.

构建绑定库.

一旦我们创建了绑定库,我们就可以在 xamarin android 项目中使用绑定库.

Once we've created the Bindings Library, we can use the Bindings Library in xamarin android project.

更多详细信息可以参考绑定 .AAR.

More detail info can refer to Binding an .AAR.

这篇关于如何在 Xamarin 中制作自定义库并导入到单独的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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